From 37545f747c61382bbf5291d28a47fef6fc4d2d0e Mon Sep 17 00:00:00 2001 From: Alp Toker <alp@nuanti.com> Date: Sat, 25 Jan 2014 16:55:45 +0000 Subject: [PATCH] Rename getResultType() on function and method declarations to getReturnType() A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200082 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang-c/Index.h | 4 +- include/clang/AST/CanonicalType.h | 6 +- include/clang/AST/Comment.h | 4 +- include/clang/AST/DataRecursiveASTVisitor.h | 53 +++++---- include/clang/AST/Decl.h | 4 +- include/clang/AST/DeclCXX.h | 2 +- include/clang/AST/DeclObjC.h | 71 +++++------- include/clang/AST/ExprObjC.h | 4 +- include/clang/AST/RecursiveASTVisitor.h | 53 +++++---- include/clang/AST/Type.h | 7 +- include/clang/AST/TypeLoc.h | 2 +- include/clang/ASTMatchers/ASTMatchers.h | 2 +- lib/ARCMigrate/ObjCMT.cpp | 31 +++--- lib/AST/ASTContext.cpp | 50 ++++----- lib/AST/ASTDumper.cpp | 2 +- lib/AST/ASTImporter.cpp | 43 +++----- lib/AST/Comment.cpp | 10 +- lib/AST/CommentSema.cpp | 2 +- lib/AST/DeclObjC.cpp | 28 ++--- lib/AST/DeclPrinter.cpp | 11 +- lib/AST/Expr.cpp | 12 +- lib/AST/ExprClassification.cpp | 2 +- lib/AST/ExprConstant.cpp | 2 +- lib/AST/ItaniumMangle.cpp | 2 +- lib/AST/MicrosoftMangle.cpp | 2 +- lib/AST/StmtPrinter.cpp | 2 +- lib/AST/Type.cpp | 12 +- lib/AST/TypePrinter.cpp | 12 +- lib/AST/VTableBuilder.cpp | 10 +- lib/Analysis/BodyFarm.cpp | 6 +- lib/CodeGen/CGBlocks.cpp | 9 +- lib/CodeGen/CGCall.cpp | 16 +-- lib/CodeGen/CGClass.cpp | 2 +- lib/CodeGen/CGDebugInfo.cpp | 4 +- lib/CodeGen/CGExpr.cpp | 4 +- lib/CodeGen/CGExprCXX.cpp | 4 +- lib/CodeGen/CGExprScalar.cpp | 2 +- lib/CodeGen/CGObjC.cpp | 33 +++--- lib/CodeGen/CGObjCMac.cpp | 4 +- lib/CodeGen/CGVTables.cpp | 6 +- lib/CodeGen/CodeGenFunction.cpp | 6 +- lib/CodeGen/CodeGenTypes.cpp | 4 +- lib/Index/USRGeneration.cpp | 2 +- lib/Parse/ParseCXXInlineMethods.cpp | 2 +- lib/Rewrite/Frontend/RewriteModernObjC.cpp | 37 +++---- lib/Rewrite/Frontend/RewriteObjC.cpp | 28 +++-- lib/Sema/AnalysisBasedWarnings.cpp | 6 +- lib/Sema/Sema.cpp | 8 +- lib/Sema/SemaAccess.cpp | 5 +- lib/Sema/SemaChecking.cpp | 2 +- lib/Sema/SemaCodeComplete.cpp | 41 ++++--- lib/Sema/SemaDecl.cpp | 95 ++++++++-------- lib/Sema/SemaDeclAttr.cpp | 25 +++-- lib/Sema/SemaDeclCXX.cpp | 28 ++--- lib/Sema/SemaDeclObjC.cpp | 103 +++++++++--------- lib/Sema/SemaExceptionSpec.cpp | 13 +-- lib/Sema/SemaExpr.cpp | 35 +++--- lib/Sema/SemaExprCXX.cpp | 2 +- lib/Sema/SemaExprObjC.cpp | 96 ++++++++-------- lib/Sema/SemaInit.cpp | 4 +- lib/Sema/SemaLambda.cpp | 10 +- lib/Sema/SemaLookup.cpp | 2 +- lib/Sema/SemaObjCProperty.cpp | 18 ++- lib/Sema/SemaOverload.cpp | 73 ++++++------- lib/Sema/SemaPseudoObject.cpp | 25 ++--- lib/Sema/SemaStmt.cpp | 12 +- lib/Sema/SemaTemplate.cpp | 6 +- lib/Sema/SemaTemplateDeduction.cpp | 76 ++++++------- lib/Sema/SemaTemplateInstantiateDecl.cpp | 14 +-- lib/Sema/SemaType.cpp | 2 +- lib/Sema/TreeTransform.h | 15 +-- lib/Serialization/ASTReaderDecl.cpp | 4 +- lib/Serialization/ASTWriter.cpp | 2 +- lib/Serialization/ASTWriterDecl.cpp | 4 +- .../Checkers/CheckObjCInstMethSignature.cpp | 4 +- .../Checkers/NSErrorChecker.cpp | 4 +- .../Checkers/RetainCountChecker.cpp | 12 +- lib/StaticAnalyzer/Core/CallEvent.cpp | 6 +- tools/libclang/CIndex.cpp | 2 +- tools/libclang/CXType.cpp | 6 +- tools/libclang/IndexDecl.cpp | 2 +- 81 files changed, 650 insertions(+), 726 deletions(-) diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 34c8fc1d2ba..d98c1e66fdd 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -2880,7 +2880,7 @@ CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); CINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); /** - * \brief Retrieve the result type associated with a function type. + * \brief Retrieve the return type associated with a function type. * * If a non-function type is passed in, an invalid type is returned. */ @@ -2908,7 +2908,7 @@ CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); /** - * \brief Retrieve the result type associated with a given cursor. + * \brief Retrieve the return type associated with a given cursor. * * This only returns a valid type if the cursor refers to a function or method. */ diff --git a/include/clang/AST/CanonicalType.h b/include/clang/AST/CanonicalType.h index d7592e964bc..4bafe23c203 100644 --- a/include/clang/AST/CanonicalType.h +++ b/include/clang/AST/CanonicalType.h @@ -541,21 +541,21 @@ struct CanProxyAdaptor<ExtVectorType> : public CanProxyBase<ExtVectorType> { template<> struct CanProxyAdaptor<FunctionType> : public CanProxyBase<FunctionType> { - LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType) + LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) }; template<> struct CanProxyAdaptor<FunctionNoProtoType> : public CanProxyBase<FunctionNoProtoType> { - LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType) + LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) }; template<> struct CanProxyAdaptor<FunctionProtoType> : public CanProxyBase<FunctionProtoType> { - LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getResultType) + LLVM_CLANG_CANPROXY_TYPE_ACCESSOR(getReturnType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(FunctionType::ExtInfo, getExtInfo) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(unsigned, getNumParams) CanQualType getParamType(unsigned i) const { diff --git a/include/clang/AST/Comment.h b/include/clang/AST/Comment.h index e67ceab3ab7..4ad575b3b70 100644 --- a/include/clang/AST/Comment.h +++ b/include/clang/AST/Comment.h @@ -981,9 +981,9 @@ struct DeclInfo { /// that we consider a "function". ArrayRef<const ParmVarDecl *> ParamVars; - /// Function result type if \c CommentDecl is something that we consider + /// Function return type if \c CommentDecl is something that we consider /// a "function". - QualType ResultType; + QualType ReturnType; /// Template parameters that can be referenced by \\tparam if \c CommentDecl is /// a template (\c IsTemplateDecl or \c IsTemplatePartialSpecialization is diff --git a/include/clang/AST/DataRecursiveASTVisitor.h b/include/clang/AST/DataRecursiveASTVisitor.h index 8038ffa7c3d..ae1be931bf2 100644 --- a/include/clang/AST/DataRecursiveASTVisitor.h +++ b/include/clang/AST/DataRecursiveASTVisitor.h @@ -866,25 +866,24 @@ DEF_TRAVERSE_TYPE(ExtVectorType, { TRY_TO(TraverseType(T->getElementType())); }) -DEF_TRAVERSE_TYPE(FunctionNoProtoType, { - TRY_TO(TraverseType(T->getResultType())); - }) +DEF_TRAVERSE_TYPE(FunctionNoProtoType, + { TRY_TO(TraverseType(T->getReturnType())); }) DEF_TRAVERSE_TYPE(FunctionProtoType, { - TRY_TO(TraverseType(T->getResultType())); + TRY_TO(TraverseType(T->getReturnType())); - for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), - AEnd = T->param_type_end(); - A != AEnd; ++A) { - TRY_TO(TraverseType(*A)); - } + for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), + AEnd = T->param_type_end(); + A != AEnd; ++A) { + TRY_TO(TraverseType(*A)); + } - for (FunctionProtoType::exception_iterator E = T->exception_begin(), - EEnd = T->exception_end(); - E != EEnd; ++E) { - TRY_TO(TraverseType(*E)); - } - }) + for (FunctionProtoType::exception_iterator E = T->exception_begin(), + EEnd = T->exception_end(); + E != EEnd; ++E) { + TRY_TO(TraverseType(*E)); + } +}) DEF_TRAVERSE_TYPE(UnresolvedUsingType, { }) DEF_TRAVERSE_TYPE(TypedefType, { }) @@ -1362,18 +1361,18 @@ DEF_TRAVERSE_DECL(ObjCProtocolDecl, { }) DEF_TRAVERSE_DECL(ObjCMethodDecl, { - if (D->getResultTypeSourceInfo()) { - TRY_TO(TraverseTypeLoc(D->getResultTypeSourceInfo()->getTypeLoc())); - } - for (ObjCMethodDecl::param_iterator - I = D->param_begin(), E = D->param_end(); I != E; ++I) { - TRY_TO(TraverseDecl(*I)); - } - if (D->isThisDeclarationADefinition()) { - TRY_TO(TraverseStmt(D->getBody())); - } - return true; - }) + if (D->getReturnTypeSourceInfo()) { + TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc())); + } + for (ObjCMethodDecl::param_iterator I = D->param_begin(), E = D->param_end(); + I != E; ++I) { + TRY_TO(TraverseDecl(*I)); + } + if (D->isThisDeclarationADefinition()) { + TRY_TO(TraverseStmt(D->getBody())); + } + return true; +}) DEF_TRAVERSE_DECL(ObjCPropertyDecl, { // FIXME: implement diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 756ceb78580..439552d1fa1 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -1868,8 +1868,8 @@ public: /// arguments (in C++). unsigned getMinRequiredArguments() const; - QualType getResultType() const { - return getType()->getAs<FunctionType>()->getResultType(); + QualType getReturnType() const { + return getType()->getAs<FunctionType>()->getReturnType(); } /// \brief Determine the type of an expression that calls this function. diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index aee2aad475d..8f5fa31d880 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -2353,7 +2353,7 @@ public: /// \brief Returns the type that this conversion function is converting to. QualType getConversionType() const { - return getType()->getAs<FunctionType>()->getResultType(); + return getType()->getAs<FunctionType>()->getReturnType(); } /// \brief Determine whether this conversion function is a conversion from diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 96d5f50380a..57ed6f75938 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -162,11 +162,11 @@ private: /// \brief Indicates if the method was a definition but its body was skipped. unsigned HasSkippedBody : 1; - // Result type of this method. + // Return type of this method. QualType MethodDeclType; - // Type source information for the result type. - TypeSourceInfo *ResultTInfo; + // Type source information for the return type. + TypeSourceInfo *ReturnTInfo; /// \brief Array of ParmVarDecls for the formal parameters of this method /// and optionally followed by selector locations. @@ -224,27 +224,22 @@ private: ArrayRef<SourceLocation> SelLocs); ObjCMethodDecl(SourceLocation beginLoc, SourceLocation endLoc, - Selector SelInfo, QualType T, - TypeSourceInfo *ResultTInfo, - DeclContext *contextDecl, - bool isInstance = true, - bool isVariadic = false, - bool isPropertyAccessor = false, - bool isImplicitlyDeclared = false, - bool isDefined = false, + Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, + DeclContext *contextDecl, bool isInstance = true, + bool isVariadic = false, bool isPropertyAccessor = false, + bool isImplicitlyDeclared = false, bool isDefined = false, ImplementationControl impControl = None, bool HasRelatedResultType = false) - : NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo), - DeclContext(ObjCMethod), Family(InvalidObjCMethodFamily), - IsInstance(isInstance), IsVariadic(isVariadic), - IsPropertyAccessor(isPropertyAccessor), - IsDefined(isDefined), IsRedeclaration(0), HasRedeclaration(0), - DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None), - RelatedResultType(HasRelatedResultType), - SelLocsKind(SelLoc_StandardNoSpace), IsOverriding(0), HasSkippedBody(0), - MethodDeclType(T), ResultTInfo(ResultTInfo), - ParamsAndSelLocs(0), NumParams(0), - DeclEndLoc(endLoc), Body(), SelfDecl(0), CmdDecl(0) { + : NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo), + DeclContext(ObjCMethod), Family(InvalidObjCMethodFamily), + IsInstance(isInstance), IsVariadic(isVariadic), + IsPropertyAccessor(isPropertyAccessor), IsDefined(isDefined), + IsRedeclaration(0), HasRedeclaration(0), DeclImplementation(impControl), + objcDeclQualifier(OBJC_TQ_None), + RelatedResultType(HasRelatedResultType), + SelLocsKind(SelLoc_StandardNoSpace), IsOverriding(0), HasSkippedBody(0), + MethodDeclType(T), ReturnTInfo(ReturnTInfo), ParamsAndSelLocs(0), + NumParams(0), DeclEndLoc(endLoc), Body(), SelfDecl(0), CmdDecl(0) { setImplicit(isImplicitlyDeclared); } @@ -254,20 +249,14 @@ private: virtual ObjCMethodDecl *getNextRedeclaration(); public: - static ObjCMethodDecl *Create(ASTContext &C, - SourceLocation beginLoc, - SourceLocation endLoc, - Selector SelInfo, - QualType T, - TypeSourceInfo *ResultTInfo, - DeclContext *contextDecl, - bool isInstance = true, - bool isVariadic = false, - bool isPropertyAccessor = false, - bool isImplicitlyDeclared = false, - bool isDefined = false, - ImplementationControl impControl = None, - bool HasRelatedResultType = false); + static ObjCMethodDecl * + Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, + Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, + DeclContext *contextDecl, bool isInstance = true, + bool isVariadic = false, bool isPropertyAccessor = false, + bool isImplicitlyDeclared = false, bool isDefined = false, + ImplementationControl impControl = None, + bool HasRelatedResultType = false); static ObjCMethodDecl *CreateDeserialized(ASTContext &C, unsigned ID); @@ -337,17 +326,17 @@ public: Selector getSelector() const { return getDeclName().getObjCSelector(); } - QualType getResultType() const { return MethodDeclType; } - void setResultType(QualType T) { MethodDeclType = T; } + QualType getReturnType() const { return MethodDeclType; } + void setReturnType(QualType T) { MethodDeclType = T; } /// \brief Determine the type of an expression that sends a message to this /// function. QualType getSendResultType() const { - return getResultType().getNonLValueExprType(getASTContext()); + return getReturnType().getNonLValueExprType(getASTContext()); } - TypeSourceInfo *getResultTypeSourceInfo() const { return ResultTInfo; } - void setResultTypeSourceInfo(TypeSourceInfo *TInfo) { ResultTInfo = TInfo; } + TypeSourceInfo *getReturnTypeSourceInfo() const { return ReturnTInfo; } + void setReturnTypeSourceInfo(TypeSourceInfo *TInfo) { ReturnTInfo = TInfo; } // Iterator access to formal parameters. unsigned param_size() const { return NumParams; } diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index aeb55da1fb9..0b114484037 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -683,13 +683,13 @@ public: if (isExplicitProperty()) { const ObjCPropertyDecl *PDecl = getExplicitProperty(); if (const ObjCMethodDecl *Getter = PDecl->getGetterMethodDecl()) - ResultType = Getter->getResultType(); + ResultType = Getter->getReturnType(); else ResultType = PDecl->getType(); } else { const ObjCMethodDecl *Getter = getImplicitPropertyGetter(); if (Getter) - ResultType = Getter->getResultType(); // with reference! + ResultType = Getter->getReturnType(); // with reference! } return ResultType; } diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index d34b30a9f1a..c5300d158bf 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -947,25 +947,24 @@ DEF_TRAVERSE_TYPE(ExtVectorType, { TRY_TO(TraverseType(T->getElementType())); }) -DEF_TRAVERSE_TYPE(FunctionNoProtoType, { - TRY_TO(TraverseType(T->getResultType())); - }) +DEF_TRAVERSE_TYPE(FunctionNoProtoType, + { TRY_TO(TraverseType(T->getReturnType())); }) DEF_TRAVERSE_TYPE(FunctionProtoType, { - TRY_TO(TraverseType(T->getResultType())); + TRY_TO(TraverseType(T->getReturnType())); - for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), - AEnd = T->param_type_end(); - A != AEnd; ++A) { - TRY_TO(TraverseType(*A)); - } + for (FunctionProtoType::param_type_iterator A = T->param_type_begin(), + AEnd = T->param_type_end(); + A != AEnd; ++A) { + TRY_TO(TraverseType(*A)); + } - for (FunctionProtoType::exception_iterator E = T->exception_begin(), - EEnd = T->exception_end(); - E != EEnd; ++E) { - TRY_TO(TraverseType(*E)); - } - }) + for (FunctionProtoType::exception_iterator E = T->exception_begin(), + EEnd = T->exception_end(); + E != EEnd; ++E) { + TRY_TO(TraverseType(*E)); + } +}) DEF_TRAVERSE_TYPE(UnresolvedUsingType, { }) DEF_TRAVERSE_TYPE(TypedefType, { }) @@ -1449,18 +1448,18 @@ DEF_TRAVERSE_DECL(ObjCProtocolDecl, { }) DEF_TRAVERSE_DECL(ObjCMethodDecl, { - if (D->getResultTypeSourceInfo()) { - TRY_TO(TraverseTypeLoc(D->getResultTypeSourceInfo()->getTypeLoc())); - } - for (ObjCMethodDecl::param_iterator - I = D->param_begin(), E = D->param_end(); I != E; ++I) { - TRY_TO(TraverseDecl(*I)); - } - if (D->isThisDeclarationADefinition()) { - TRY_TO(TraverseStmt(D->getBody())); - } - return true; - }) + if (D->getReturnTypeSourceInfo()) { + TRY_TO(TraverseTypeLoc(D->getReturnTypeSourceInfo()->getTypeLoc())); + } + for (ObjCMethodDecl::param_iterator I = D->param_begin(), E = D->param_end(); + I != E; ++I) { + TRY_TO(TraverseDecl(*I)); + } + if (D->isThisDeclarationADefinition()) { + TRY_TO(TraverseStmt(D->getBody())); + } + return true; +}) DEF_TRAVERSE_DECL(ObjCPropertyDecl, { // FIXME: implement diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 82e947fb5bf..261252a7dc5 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -2779,8 +2779,7 @@ protected: unsigned getTypeQuals() const { return FunctionTypeBits.TypeQuals; } public: - - QualType getResultType() const { return ResultType; } + QualType getReturnType() const { return ResultType; } bool getHasRegParm() const { return getExtInfo().getHasRegParm(); } unsigned getRegParmType() const { return getExtInfo().getRegParm(); } @@ -2797,7 +2796,7 @@ public: /// \brief Determine the type of an expression that calls a function of /// this type. QualType getCallResultType(ASTContext &Context) const { - return getResultType().getNonLValueExprType(Context); + return getReturnType().getNonLValueExprType(Context); } static StringRef getNameForCallConv(CallingConv CC); @@ -2826,7 +2825,7 @@ public: QualType desugar() const { return QualType(this, 0); } void Profile(llvm::FoldingSetNodeID &ID) { - Profile(ID, getResultType(), getExtInfo()); + Profile(ID, getReturnType(), getExtInfo()); } static void Profile(llvm::FoldingSetNodeID &ID, QualType ResultType, ExtInfo Info) { diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index 8f51d0d4eee..633089dccc7 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -1251,7 +1251,7 @@ public: return llvm::alignOf<ParmVarDecl*>(); } - QualType getInnerType() const { return getTypePtr()->getResultType(); } + QualType getInnerType() const { return getTypePtr()->getReturnType(); } }; class FunctionProtoTypeLoc : diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 31571a66b58..c2f4928e8f5 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -2231,7 +2231,7 @@ AST_MATCHER_P(FunctionDecl, parameterCountIs, unsigned, N) { /// matches int f() { return 1; } AST_MATCHER_P(FunctionDecl, returns, internal::Matcher<QualType>, InnerMatcher) { - return InnerMatcher.matches(Node.getResultType(), Finder, Builder); + return InnerMatcher.matches(Node.getReturnType(), Finder, Builder); } /// \brief Matches extern "C" function declarations. diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index ace5bfd53a5..af88cb6bc1f 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -385,11 +385,11 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter, if (PropertyName.equals("target") || (PropertyName.find("delegate") != StringRef::npos) || (PropertyName.find("dataSource") != StringRef::npos)) { - QualType QT = Getter->getResultType(); + QualType QT = Getter->getReturnType(); if (!QT->isRealType()) append_attr(PropertyString, "assign", LParenAdded); } else if (!Setter) { - QualType ResType = Context.getCanonicalType(Getter->getResultType()); + QualType ResType = Context.getCanonicalType(Getter->getReturnType()); if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ResType)) append_attr(PropertyString, MemoryManagementAttr, LParenAdded); } else { @@ -400,7 +400,7 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter, } if (LParenAdded) PropertyString += ')'; - QualType RT = Getter->getResultType(); + QualType RT = Getter->getReturnType(); if (!isa<TypedefType>(RT)) { // strip off any ARC lifetime qualifier. QualType CanResultTy = Context.getCanonicalType(RT); @@ -844,7 +844,7 @@ static void ReplaceWithInstancetype(const ObjCMigrateASTConsumer &ASTC, ObjCMethodDecl *OM) { SourceRange R; std::string ClassString; - if (TypeSourceInfo *TSInfo = OM->getResultTypeSourceInfo()) { + if (TypeSourceInfo *TSInfo = OM->getReturnTypeSourceInfo()) { TypeLoc TL = TSInfo->getTypeLoc(); R = SourceRange(TL.getBeginLoc(), TL.getEndLoc()); ClassString = "instancetype"; @@ -864,7 +864,7 @@ static void ReplaceWithClasstype(const ObjCMigrateASTConsumer &ASTC, ObjCInterfaceDecl *IDecl = OM->getClassInterface(); SourceRange R; std::string ClassString; - if (TypeSourceInfo *TSInfo = OM->getResultTypeSourceInfo()) { + if (TypeSourceInfo *TSInfo = OM->getReturnTypeSourceInfo()) { TypeLoc TL = TSInfo->getTypeLoc(); R = SourceRange(TL.getBeginLoc(), TL.getEndLoc()); { ClassString = IDecl->getName(); @@ -902,14 +902,14 @@ void ObjCMigrateASTConsumer::migrateMethodInstanceType(ASTContext &Ctx, migrateFactoryMethod(Ctx, CDecl, OM, OIT_Singleton); return; case OIT_Init: - if (OM->getResultType()->isObjCIdType()) + if (OM->getReturnType()->isObjCIdType()) ReplaceWithInstancetype(*this, OM); return; case OIT_ReturnsSelf: migrateFactoryMethod(Ctx, CDecl, OM, OIT_ReturnsSelf); return; } - if (!OM->getResultType()->isObjCIdType()) + if (!OM->getReturnType()->isObjCIdType()) return; ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl); @@ -1043,7 +1043,7 @@ bool ObjCMigrateASTConsumer::migrateProperty(ASTContext &Ctx, Method->param_size() != 0) return false; // Is this method candidate to be a getter? - QualType GRT = Method->getResultType(); + QualType GRT = Method->getReturnType(); if (GRT->isVoidType()) return false; @@ -1096,7 +1096,7 @@ bool ObjCMigrateASTConsumer::migrateProperty(ASTContext &Ctx, return false; // Is this a valid setter, matching the target getter? - QualType SRT = SetterMethod->getResultType(); + QualType SRT = SetterMethod->getReturnType(); if (!SRT->isVoidType()) return false; const ParmVarDecl *argDecl = *SetterMethod->param_begin(); @@ -1137,8 +1137,8 @@ void ObjCMigrateASTConsumer::migrateNsReturnsInnerPointer(ASTContext &Ctx, !OM->isInstanceMethod() || OM->hasAttr<ObjCReturnsInnerPointerAttr>()) return; - - QualType RT = OM->getResultType(); + + QualType RT = OM->getReturnType(); if (!TypeIsInnerPointer(RT) || !Ctx.Idents.get("NS_RETURNS_INNER_POINTER").hasMacroDefinition()) return; @@ -1181,8 +1181,8 @@ void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx, ObjCMethodDecl *OM, ObjCInstanceTypeFamily OIT_Family) { if (OM->isInstanceMethod() || - OM->getResultType() == Ctx.getObjCInstanceType() || - !OM->getResultType()->isObjCIdType()) + OM->getReturnType() == Ctx.getObjCInstanceType() || + !OM->getReturnType()->isObjCIdType()) return; // Candidate factory methods are + (id) NaMeXXX : ... which belong to a class @@ -1414,7 +1414,7 @@ ObjCMigrateASTConsumer::CF_BRIDGING_KIND if (Ret.getObjKind() == RetEffect::CF && (Ret.isOwned() || Ret.notOwned())) ReturnCFAudited = true; - else if (!AuditedType(FuncDecl->getResultType())) + else if (!AuditedType(FuncDecl->getReturnType())) return CF_BRIDGING_NONE; } @@ -1551,8 +1551,7 @@ void ObjCMigrateASTConsumer::migrateAddMethodAnnotation( (Ret.isOwned() || Ret.notOwned())) { AddCFAnnotations(Ctx, CE, MethodDecl, false); return; - } - else if (!AuditedType(MethodDecl->getResultType())) + } else if (!AuditedType(MethodDecl->getReturnType())) return; } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c3914d34198..ad3bf5105dd 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2083,12 +2083,12 @@ const FunctionType *ASTContext::adjustFunctionType(const FunctionType *T, QualType Result; if (const FunctionNoProtoType *FNPT = dyn_cast<FunctionNoProtoType>(T)) { - Result = getFunctionNoProtoType(FNPT->getResultType(), Info); + Result = getFunctionNoProtoType(FNPT->getReturnType(), Info); } else { const FunctionProtoType *FPT = cast<FunctionProtoType>(T); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExtInfo = Info; - Result = getFunctionType(FPT->getResultType(), FPT->getParamTypes(), EPI); + Result = getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI); } return cast<FunctionType>(Result.getTypePtr()); @@ -4795,12 +4795,11 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { Expr->getType()->getAs<BlockPointerType>()->getPointeeType(); // Encode result type. if (getLangOpts().EncodeExtendedBlockSig) - getObjCEncodingForMethodParameter(Decl::OBJC_TQ_None, - BlockTy->getAs<FunctionType>()->getResultType(), - S, true /*Extended*/); + getObjCEncodingForMethodParameter( + Decl::OBJC_TQ_None, BlockTy->getAs<FunctionType>()->getReturnType(), S, + true /*Extended*/); else - getObjCEncodingForType(BlockTy->getAs<FunctionType>()->getResultType(), - S); + getObjCEncodingForType(BlockTy->getAs<FunctionType>()->getReturnType(), S); // Compute size of all parameters. // Start with computing size of a pointer in number of bytes. // FIXME: There might(should) be a better way of doing this computation! @@ -4850,7 +4849,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const { bool ASTContext::getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, std::string& S) { // Encode result type. - getObjCEncodingForType(Decl->getResultType(), S); + getObjCEncodingForType(Decl->getReturnType(), S); CharUnits ParmOffset; // Compute size of all parameters. for (FunctionDecl::param_const_iterator PI = Decl->param_begin(), @@ -4912,8 +4911,8 @@ bool ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended) const { // FIXME: This is not very efficient. // Encode return type. - getObjCEncodingForMethodParameter(Decl->getObjCDeclQualifier(), - Decl->getResultType(), S, Extended); + getObjCEncodingForMethodParameter(Decl->getObjCDeclQualifier(), + Decl->getReturnType(), S, Extended); // Compute size of all parameters. // Start with computing size of a pointer in number of bytes. // FIXME: There might(should) be a better way of doing this computation! @@ -5414,14 +5413,10 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, S += '<'; // Block return type - getObjCEncodingForTypeImpl(FT->getResultType(), S, - ExpandPointedToStructures, ExpandStructures, - FD, - false /* OutermostType */, - EncodingProperty, - false /* StructField */, - EncodeBlockParameters, - EncodeClassNames); + getObjCEncodingForTypeImpl( + FT->getReturnType(), S, ExpandPointedToStructures, ExpandStructures, + FD, false /* OutermostType */, EncodingProperty, + false /* StructField */, EncodeBlockParameters, EncodeClassNames); // Block self S += "@?"; // Block parameters @@ -6893,23 +6888,23 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, // Check return type QualType retType; if (OfBlockPointer) { - QualType RHS = rbase->getResultType(); - QualType LHS = lbase->getResultType(); + QualType RHS = rbase->getReturnType(); + QualType LHS = lbase->getReturnType(); bool UnqualifiedResult = Unqualified; if (!UnqualifiedResult) UnqualifiedResult = (!RHS.hasQualifiers() && LHS.hasQualifiers()); retType = mergeTypes(LHS, RHS, true, UnqualifiedResult, true); } else - retType = mergeTypes(lbase->getResultType(), rbase->getResultType(), false, + retType = mergeTypes(lbase->getReturnType(), rbase->getReturnType(), false, Unqualified); if (retType.isNull()) return QualType(); if (Unqualified) retType = retType.getUnqualifiedType(); - CanQualType LRetType = getCanonicalType(lbase->getResultType()); - CanQualType RRetType = getCanonicalType(rbase->getResultType()); + CanQualType LRetType = getCanonicalType(lbase->getReturnType()); + CanQualType RRetType = getCanonicalType(rbase->getReturnType()); if (Unqualified) { LRetType = LRetType.getUnqualifiedType(); RRetType = RRetType.getUnqualifiedType(); @@ -7365,10 +7360,10 @@ QualType ASTContext::mergeObjCGCQualifiers(QualType LHS, QualType RHS) { if (RHSCan->isFunctionType()) { if (!LHSCan->isFunctionType()) return QualType(); - QualType OldReturnType = - cast<FunctionType>(RHSCan.getTypePtr())->getResultType(); + QualType OldReturnType = + cast<FunctionType>(RHSCan.getTypePtr())->getReturnType(); QualType NewReturnType = - cast<FunctionType>(LHSCan.getTypePtr())->getResultType(); + cast<FunctionType>(LHSCan.getTypePtr())->getReturnType(); QualType ResReturnType = mergeObjCGCQualifiers(NewReturnType, OldReturnType); if (ResReturnType.isNull()) @@ -8179,8 +8174,7 @@ ASTContext::ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, if (MethodDecl->getObjCDeclQualifier() != MethodImpl->getObjCDeclQualifier()) return false; - if (!hasSameType(MethodDecl->getResultType(), - MethodImpl->getResultType())) + if (!hasSameType(MethodDecl->getReturnType(), MethodImpl->getReturnType())) return false; if (MethodDecl->param_size() != MethodImpl->param_size()) diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index 1ee114f3ddf..c8800356ef9 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -1270,7 +1270,7 @@ void ASTDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) { else OS << " +"; dumpName(D); - dumpType(D->getResultType()); + dumpType(D->getReturnType()); bool OldMoreChildren = hasMoreChildren(); bool IsVariadic = D->isVariadic(); diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp index e6776ac1b87..e4a06ee7f8e 100644 --- a/lib/AST/ASTImporter.cpp +++ b/lib/AST/ASTImporter.cpp @@ -570,9 +570,8 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context, case Type::FunctionNoProto: { const FunctionType *Function1 = cast<FunctionType>(T1); const FunctionType *Function2 = cast<FunctionType>(T2); - if (!IsStructurallyEquivalent(Context, - Function1->getResultType(), - Function2->getResultType())) + if (!IsStructurallyEquivalent(Context, Function1->getReturnType(), + Function2->getReturnType())) return false; if (Function1->getExtInfo() != Function2->getExtInfo()) return false; @@ -1586,7 +1585,7 @@ QualType ASTNodeImporter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) { // FIXME: What happens if we're importing a function without a prototype // into C++? Should we make it variadic? - QualType ToResultType = Importer.Import(T->getResultType()); + QualType ToResultType = Importer.Import(T->getReturnType()); if (ToResultType.isNull()) return QualType(); @@ -1595,7 +1594,7 @@ ASTNodeImporter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) { } QualType ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) { - QualType ToResultType = Importer.Import(T->getResultType()); + QualType ToResultType = Importer.Import(T->getReturnType()); if (ToResultType.isNull()) return QualType(); @@ -2717,7 +2716,7 @@ Decl *ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) { FromEPI.NoexceptExpr) { FunctionProtoType::ExtProtoInfo DefaultEPI; FromTy = Importer.getFromContext().getFunctionType( - FromFPT->getResultType(), FromFPT->getParamTypes(), DefaultEPI); + FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI); usedDifferentExceptionSpec = true; } } @@ -3215,11 +3214,11 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) { continue; // Check return types. - if (!Importer.IsStructurallyEquivalent(D->getResultType(), - FoundMethod->getResultType())) { + if (!Importer.IsStructurallyEquivalent(D->getReturnType(), + FoundMethod->getReturnType())) { Importer.ToDiag(Loc, diag::err_odr_objc_method_result_type_inconsistent) - << D->isInstanceMethod() << Name - << D->getResultType() << FoundMethod->getResultType(); + << D->isInstanceMethod() << Name << D->getReturnType() + << FoundMethod->getReturnType(); Importer.ToDiag(FoundMethod->getLocation(), diag::note_odr_objc_method_here) << D->isInstanceMethod() << Name; @@ -3270,25 +3269,17 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) { } // Import the result type. - QualType ResultTy = Importer.Import(D->getResultType()); + QualType ResultTy = Importer.Import(D->getReturnType()); if (ResultTy.isNull()) return 0; - TypeSourceInfo *ResultTInfo = Importer.Import(D->getResultTypeSourceInfo()); - - ObjCMethodDecl *ToMethod - = ObjCMethodDecl::Create(Importer.getToContext(), - Loc, - Importer.Import(D->getLocEnd()), - Name.getObjCSelector(), - ResultTy, ResultTInfo, DC, - D->isInstanceMethod(), - D->isVariadic(), - D->isPropertyAccessor(), - D->isImplicit(), - D->isDefined(), - D->getImplementationControl(), - D->hasRelatedResultType()); + TypeSourceInfo *ReturnTInfo = Importer.Import(D->getReturnTypeSourceInfo()); + + ObjCMethodDecl *ToMethod = ObjCMethodDecl::Create( + Importer.getToContext(), Loc, Importer.Import(D->getLocEnd()), + Name.getObjCSelector(), ResultTy, ReturnTInfo, DC, D->isInstanceMethod(), + D->isVariadic(), D->isPropertyAccessor(), D->isImplicit(), D->isDefined(), + D->getImplementationControl(), D->hasRelatedResultType()); // FIXME: When we decide to merge method definitions, we'll need to // deal with implicit parameters. diff --git a/lib/AST/Comment.cpp b/lib/AST/Comment.cpp index be0a29fc8fb..b736b4825e5 100644 --- a/lib/AST/Comment.cpp +++ b/lib/AST/Comment.cpp @@ -159,7 +159,7 @@ void DeclInfo::fill() { Kind = FunctionKind; ParamVars = ArrayRef<const ParmVarDecl *>(FD->param_begin(), FD->getNumParams()); - ResultType = FD->getResultType(); + ReturnType = FD->getReturnType(); unsigned NumLists = FD->getNumTemplateParameterLists(); if (NumLists != 0) { TemplateKind = TemplateSpecialization; @@ -180,7 +180,7 @@ void DeclInfo::fill() { Kind = FunctionKind; ParamVars = ArrayRef<const ParmVarDecl *>(MD->param_begin(), MD->param_size()); - ResultType = MD->getResultType(); + ReturnType = MD->getReturnType(); IsObjCMethod = true; IsInstanceMethod = MD->isInstanceMethod(); IsClassMethod = !IsInstanceMethod; @@ -193,7 +193,7 @@ void DeclInfo::fill() { const FunctionDecl *FD = FTD->getTemplatedDecl(); ParamVars = ArrayRef<const ParmVarDecl *>(FD->param_begin(), FD->getNumParams()); - ResultType = FD->getResultType(); + ReturnType = FD->getReturnType(); TemplateParameters = FTD->getTemplateParameters(); break; } @@ -281,7 +281,7 @@ void DeclInfo::fill() { ArrayRef<ParmVarDecl *> Params = FTL.getParams(); ParamVars = ArrayRef<const ParmVarDecl *>(Params.data(), Params.size()); - ResultType = FTL.getResultLoc().getType(); + ReturnType = FTL.getResultLoc().getType(); break; } if (TemplateSpecializationTypeLoc STL = @@ -302,7 +302,7 @@ void DeclInfo::fill() { ArrayRef<ParmVarDecl *> Params = FTL.getParams(); ParamVars = ArrayRef<const ParmVarDecl *>(Params.data(), Params.size()); - ResultType = FTL.getResultLoc().getType(); + ReturnType = FTL.getResultLoc().getType(); } break; } diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index d324c5c20d5..450325f91dc 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -559,7 +559,7 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { if (!Traits.getCommandInfo(Command->getCommandID())->IsReturnsCommand) return; if (isFunctionDecl()) { - if (ThisDeclInfo->ResultType->isVoidType()) { + if (ThisDeclInfo->ReturnType->isVoidType()) { unsigned DiagKind; switch (ThisDeclInfo->CommentDecl->getKind()) { default: diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index e1e56df2f27..ed8a0bb748f 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -639,21 +639,14 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod( // ObjCMethodDecl //===----------------------------------------------------------------------===// -ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C, - SourceLocation beginLoc, - SourceLocation endLoc, - Selector SelInfo, QualType T, - TypeSourceInfo *ResultTInfo, - DeclContext *contextDecl, - bool isInstance, - bool isVariadic, - bool isPropertyAccessor, - bool isImplicitlyDeclared, - bool isDefined, - ImplementationControl impControl, - bool HasRelatedResultType) { +ObjCMethodDecl *ObjCMethodDecl::Create( + ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, + Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, + DeclContext *contextDecl, bool isInstance, bool isVariadic, + bool isPropertyAccessor, bool isImplicitlyDeclared, bool isDefined, + ImplementationControl impControl, bool HasRelatedResultType) { return new (C, contextDecl) ObjCMethodDecl( - beginLoc, endLoc, SelInfo, T, ResultTInfo, contextDecl, isInstance, + beginLoc, endLoc, SelInfo, T, ReturnTInfo, contextDecl, isInstance, isVariadic, isPropertyAccessor, isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType); } @@ -833,7 +826,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { // init only has a conventional meaning for an instance method, and // it has to return an object. case OMF_init: - if (!isInstanceMethod() || !getResultType()->isObjCObjectPointerType()) + if (!isInstanceMethod() || !getReturnType()->isObjCObjectPointerType()) family = OMF_None; break; @@ -843,7 +836,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { case OMF_copy: case OMF_mutableCopy: case OMF_new: - if (!getResultType()->isObjCObjectPointerType()) + if (!getReturnType()->isObjCObjectPointerType()) family = OMF_None; break; @@ -860,8 +853,7 @@ ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const { break; case OMF_performSelector: - if (!isInstanceMethod() || - !getResultType()->isObjCIdType()) + if (!isInstanceMethod() || !getReturnType()->isObjCIdType()) family = OMF_None; else { unsigned noParams = param_size(); diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 4b289ca2264..aa753887a21 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -114,7 +114,7 @@ static QualType GetBaseType(QualType T) { else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType)) BaseType = ATy->getElementType(); else if (const FunctionType* FTy = BaseType->getAs<FunctionType>()) - BaseType = FTy->getResultType(); + BaseType = FTy->getReturnType(); else if (const VectorType *VTy = BaseType->getAs<VectorType>()) BaseType = VTy->getElementType(); else if (const ReferenceType *RTy = BaseType->getAs<ReferenceType>()) @@ -543,7 +543,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { Out << "auto " << Proto << " -> "; Proto.clear(); } - AFT->getResultType().print(Out, Policy, Proto); + AFT->getReturnType().print(Out, Policy, Proto); } } else { Ty.print(Out, Policy, Proto); @@ -905,9 +905,10 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) { Out << "- "; else Out << "+ "; - if (!OMD->getResultType().isNull()) - Out << '(' << OMD->getASTContext().getUnqualifiedObjCPointerType(OMD->getResultType()). - getAsString(Policy) << ")"; + if (!OMD->getReturnType().isNull()) + Out << '(' << OMD->getASTContext() + .getUnqualifiedObjCPointerType(OMD->getReturnType()) + .getAsString(Policy) << ")"; std::string name = OMD->getSelector().getAsString(); std::string::size_type pos, lastPos = 0; diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 154aa4c5380..e4b670dae7a 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -588,13 +588,15 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) { // not a constructor or destructor. if ((isa<CXXMethodDecl>(FD) && cast<CXXMethodDecl>(FD)->getParent()->isLambda()) || - (FT && FT->getResultType()->getAs<AutoType>())) + (FT && FT->getReturnType()->getAs<AutoType>())) Proto = "auto " + Proto; - else if (FT && FT->getResultType()->getAs<DecltypeType>()) - FT->getResultType()->getAs<DecltypeType>()->getUnderlyingType() + else if (FT && FT->getReturnType()->getAs<DecltypeType>()) + FT->getReturnType() + ->getAs<DecltypeType>() + ->getUnderlyingType() .getAsStringInternal(Proto, Policy); else if (!isa<CXXConstructorDecl>(FD) && !isa<CXXDestructorDecl>(FD)) - AFT->getResultType().getAsStringInternal(Proto, Policy); + AFT->getReturnType().getAsStringInternal(Proto, Policy); Out << Proto; @@ -1225,7 +1227,7 @@ QualType CallExpr::getCallReturnType() const { CalleeType = Expr::findBoundMemberType(getCallee()); const FunctionType *FnType = CalleeType->castAs<FunctionType>(); - return FnType->getResultType(); + return FnType->getReturnType(); } SourceLocation CallExpr::getLocStart() const { diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp index aeb65405671..f9d2b2c7788 100644 --- a/lib/AST/ExprClassification.cpp +++ b/lib/AST/ExprClassification.cpp @@ -346,7 +346,7 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { case Expr::ObjCMessageExprClass: if (const ObjCMethodDecl *Method = cast<ObjCMessageExpr>(E)->getMethodDecl()) { - Cl::Kinds kind = ClassifyUnnamed(Ctx, Method->getResultType()); + Cl::Kinds kind = ClassifyUnnamed(Ctx, Method->getReturnType()); return (kind == Cl::CL_PRValue) ? Cl::CL_ObjCMessageRValue : kind; } return Cl::CL_PRValue; diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index e836e18238c..18c3ff1b24a 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -3618,7 +3618,7 @@ static bool HandleFunctionCall(SourceLocation CallLoc, EvalStmtResult ESR = EvaluateStmt(Result, Info, Body); if (ESR == ESR_Succeeded) { - if (Callee->getResultType()->isVoidType()) + if (Callee->getReturnType()->isVoidType()) return true; Info.Diag(Callee->getLocEnd(), diag::note_constexpr_no_return); } diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp index 99f419790ce..ca546d5fc63 100644 --- a/lib/AST/ItaniumMangle.cpp +++ b/lib/AST/ItaniumMangle.cpp @@ -2013,7 +2013,7 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T, // <bare-function-type> ::= <signature type>+ if (MangleReturnType) { FunctionTypeDepth.enterResultType(); - mangleType(Proto->getResultType()); + mangleType(Proto->getReturnType()); FunctionTypeDepth.leaveResultType(); } diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index ece12049e7a..979523af4b1 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -1327,7 +1327,7 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T, } Out << '@'; } else { - QualType ResultType = Proto->getResultType(); + QualType ResultType = Proto->getReturnType(); if (ResultType->isVoidType()) ResultType = ResultType.getUnqualifiedType(); mangleType(ResultType, Range, QMM_Result); diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index d15dfd10d54..6ece8af9583 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -1527,7 +1527,7 @@ void StmtPrinter::VisitLambdaExpr(LambdaExpr *Node) { // Print the trailing return type if it was specified in the source. if (Node->hasExplicitResultType()) { OS << " -> "; - Proto->getResultType().print(OS, Policy); + Proto->getReturnType().print(OS, Policy); } } diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 2eac8af2f11..26534d7b437 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -585,7 +585,7 @@ namespace { return Visit(T->getElementType()); } AutoType *VisitFunctionType(const FunctionType *T) { - return Visit(T->getResultType()); + return Visit(T->getReturnType()); } AutoType *VisitParenType(const ParenType *T) { return Visit(T->getInnerType()); @@ -1776,7 +1776,7 @@ void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result, void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) { - Profile(ID, getResultType(), param_type_begin(), NumParams, getExtProtoInfo(), + Profile(ID, getReturnType(), param_type_begin(), NumParams, getExtProtoInfo(), Ctx); } @@ -2226,10 +2226,10 @@ static CachedProperties computeCachedProperties(const Type *T) { case Type::ExtVector: return Cache::get(cast<VectorType>(T)->getElementType()); case Type::FunctionNoProto: - return Cache::get(cast<FunctionType>(T)->getResultType()); + return Cache::get(cast<FunctionType>(T)->getReturnType()); case Type::FunctionProto: { const FunctionProtoType *FPT = cast<FunctionProtoType>(T); - CachedProperties result = Cache::get(FPT->getResultType()); + CachedProperties result = Cache::get(FPT->getReturnType()); for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(), ae = FPT->param_type_end(); ai != ae; ++ai) @@ -2312,10 +2312,10 @@ static LinkageInfo computeLinkageInfo(const Type *T) { case Type::ExtVector: return computeLinkageInfo(cast<VectorType>(T)->getElementType()); case Type::FunctionNoProto: - return computeLinkageInfo(cast<FunctionType>(T)->getResultType()); + return computeLinkageInfo(cast<FunctionType>(T)->getReturnType()); case Type::FunctionProto: { const FunctionProtoType *FPT = cast<FunctionProtoType>(T); - LinkageInfo LV = computeLinkageInfo(FPT->getResultType()); + LinkageInfo LV = computeLinkageInfo(FPT->getReturnType()); for (FunctionProtoType::param_type_iterator ai = FPT->param_type_begin(), ae = FPT->param_type_end(); ai != ae; ++ai) diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp index 9f7cf5196ad..9c96aee2dff 100644 --- a/lib/AST/TypePrinter.cpp +++ b/lib/AST/TypePrinter.cpp @@ -608,7 +608,7 @@ void TypePrinter::printFunctionProtoBefore(const FunctionProtoType *T, } else { // If needed for precedence reasons, wrap the inner part in grouping parens. SaveAndRestore<bool> PrevPHIsEmpty(HasEmptyPlaceHolder, false); - printBefore(T->getResultType(), OS); + printBefore(T->getReturnType(), OS); if (!PrevPHIsEmpty.get()) OS << '('; } @@ -713,17 +713,17 @@ void TypePrinter::printFunctionProtoAfter(const FunctionProtoType *T, T->printExceptionSpecification(OS, Policy); if (T->hasTrailingReturn()) { - OS << " -> "; - print(T->getResultType(), OS, StringRef()); + OS << " -> "; + print(T->getReturnType(), OS, StringRef()); } else - printAfter(T->getResultType(), OS); + printAfter(T->getReturnType(), OS); } void TypePrinter::printFunctionNoProtoBefore(const FunctionNoProtoType *T, raw_ostream &OS) { // If needed for precedence reasons, wrap the inner part in grouping parens. SaveAndRestore<bool> PrevPHIsEmpty(HasEmptyPlaceHolder, false); - printBefore(T->getResultType(), OS); + printBefore(T->getReturnType(), OS); if (!PrevPHIsEmpty.get()) OS << '('; } @@ -737,7 +737,7 @@ void TypePrinter::printFunctionNoProtoAfter(const FunctionNoProtoType *T, OS << "()"; if (T->getNoReturnAttr()) OS << " __attribute__((noreturn))"; - printAfter(T->getResultType(), OS); + printAfter(T->getReturnType(), OS); } void TypePrinter::printTypeSpec(const NamedDecl *D, raw_ostream &OS) { diff --git a/lib/AST/VTableBuilder.cpp b/lib/AST/VTableBuilder.cpp index af4986e27ec..30f95d0f25b 100644 --- a/lib/AST/VTableBuilder.cpp +++ b/lib/AST/VTableBuilder.cpp @@ -269,11 +269,11 @@ ComputeReturnAdjustmentBaseOffset(ASTContext &Context, const FunctionType *DerivedFT = DerivedMD->getType()->getAs<FunctionType>(); // Canonicalize the return types. - CanQualType CanDerivedReturnType = - Context.getCanonicalType(DerivedFT->getResultType()); - CanQualType CanBaseReturnType = - Context.getCanonicalType(BaseFT->getResultType()); - + CanQualType CanDerivedReturnType = + Context.getCanonicalType(DerivedFT->getReturnType()); + CanQualType CanBaseReturnType = + Context.getCanonicalType(BaseFT->getReturnType()); + assert(CanDerivedReturnType->getTypeClass() == CanBaseReturnType->getTypeClass() && "Types must have same type class!"); diff --git a/lib/Analysis/BodyFarm.cpp b/lib/Analysis/BodyFarm.cpp index 737e15061e1..c857a0ef493 100644 --- a/lib/Analysis/BodyFarm.cpp +++ b/lib/Analysis/BodyFarm.cpp @@ -35,7 +35,7 @@ static bool isDispatchBlock(QualType Ty) { // returns void. const FunctionProtoType *FT = BPT->getPointeeType()->getAs<FunctionProtoType>(); - if (!FT || !FT->getResultType()->isVoidType() || FT->getNumParams() != 0) + if (!FT || !FT->getReturnType()->isVoidType() || FT->getNumParams() != 0) return false; return true; @@ -289,8 +289,8 @@ static Stmt *create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D) // return YES; // } // else return NO; - - QualType ResultTy = D->getResultType(); + + QualType ResultTy = D->getReturnType(); bool isBoolean = ResultTy->isBooleanType(); if (!isBoolean && !ResultTy->isIntegralType(C)) return 0; diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp index 3b5c8187530..e174f8595ba 100644 --- a/lib/CodeGen/CGBlocks.cpp +++ b/lib/CodeGen/CGBlocks.cpp @@ -1123,10 +1123,9 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, // Create the function declaration. const FunctionProtoType *fnType = blockInfo.getBlockExpr()->getFunctionType(); - const CGFunctionInfo &fnInfo = - CGM.getTypes().arrangeFunctionDeclaration(fnType->getResultType(), args, - fnType->getExtInfo(), - fnType->isVariadic()); + const CGFunctionInfo &fnInfo = CGM.getTypes().arrangeFunctionDeclaration( + fnType->getReturnType(), args, fnType->getExtInfo(), + fnType->isVariadic()); if (CGM.ReturnTypeUsesSRet(fnInfo)) blockInfo.UsesStret = true; @@ -1140,7 +1139,7 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, CGM.SetInternalFunctionAttributes(blockDecl, fn, fnInfo); // Begin generating the function. - StartFunction(blockDecl, fnType->getResultType(), fn, fnInfo, args, + StartFunction(blockDecl, fnType->getReturnType(), fn, fnInfo, args, blockInfo.getBlockExpr()->getBody()->getLocStart()); // Okay. Undo some of what StartFunction did. diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 78e22633068..8e676932455 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -79,7 +79,7 @@ const CGFunctionInfo & CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> FTNP) { // When translating an unprototyped function type, always use a // variadic type. - return arrangeLLVMFunctionInfo(FTNP->getResultType().getUnqualifiedType(), + return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(), None, FTNP->getExtInfo(), RequiredArgs(0)); } @@ -94,7 +94,7 @@ static const CGFunctionInfo &arrangeLLVMFunctionInfo(CodeGenTypes &CGT, // FIXME: Kill copy. for (unsigned i = 0, e = FTP->getNumParams(); i != e; ++i) prefix.push_back(FTP->getParamType(i)); - CanQualType resultType = FTP->getResultType().getUnqualifiedType(); + CanQualType resultType = FTP->getReturnType().getUnqualifiedType(); return CGT.arrangeLLVMFunctionInfo(resultType, prefix, extInfo, required); } @@ -263,7 +263,7 @@ CodeGenTypes::arrangeFunctionDeclaration(const FunctionDecl *FD) { // non-variadic type. if (isa<FunctionNoProtoType>(FTy)) { CanQual<FunctionNoProtoType> noProto = FTy.getAs<FunctionNoProtoType>(); - return arrangeLLVMFunctionInfo(noProto->getResultType(), None, + return arrangeLLVMFunctionInfo(noProto->getReturnType(), None, noProto->getExtInfo(), RequiredArgs::All); } @@ -309,7 +309,7 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, RequiredArgs required = (MD->isVariadic() ? RequiredArgs(argTys.size()) : RequiredArgs::All); - return arrangeLLVMFunctionInfo(GetReturnType(MD->getResultType()), argTys, + return arrangeLLVMFunctionInfo(GetReturnType(MD->getReturnType()), argTys, einfo, required); } @@ -356,7 +356,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT, required = RequiredArgs(args.size()); } - return CGT.arrangeFreeFunctionCall(fnType->getResultType(), args, + return CGT.arrangeFreeFunctionCall(fnType->getReturnType(), args, fnType->getExtInfo(), required); } @@ -404,8 +404,8 @@ CodeGenTypes::arrangeCXXMethodCall(const CallArgList &args, argTypes.push_back(Context.getCanonicalParamType(i->Ty)); FunctionType::ExtInfo info = FPT->getExtInfo(); - return arrangeLLVMFunctionInfo(GetReturnType(FPT->getResultType()), - argTypes, info, required); + return arrangeLLVMFunctionInfo(GetReturnType(FPT->getReturnType()), argTypes, + info, required); } const CGFunctionInfo & @@ -1232,7 +1232,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, // return statements. if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(CurCodeDecl)) { if (FD->hasImplicitReturnZero()) { - QualType RetTy = FD->getResultType().getUnqualifiedType(); + QualType RetTy = FD->getReturnType().getUnqualifiedType(); llvm::Type* LLVMTy = CGM.getTypes().ConvertType(RetTy); llvm::Constant* Zero = llvm::Constant::getNullValue(LLVMTy); Builder.CreateStore(Zero, ReturnValue); diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index 8577c3e034a..273fed52d5c 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -2129,7 +2129,7 @@ void CodeGenFunction::EmitForwardingCallToLambda( // Prepare the return slot. const FunctionProtoType *FPT = callOperator->getType()->castAs<FunctionProtoType>(); - QualType resultType = FPT->getResultType(); + QualType resultType = FPT->getReturnType(); ReturnValueSlot returnSlot; if (!resultType->isVoidType() && calleeFnInfo.getReturnInfo().getKind() == ABIArgInfo::Indirect && diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index ff17a03dccd..59ba47c334c 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -756,7 +756,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, SmallVector<llvm::Value *, 16> EltTys; // Add the result type at least. - EltTys.push_back(getOrCreateType(Ty->getResultType(), Unit)); + EltTys.push_back(getOrCreateType(Ty->getReturnType(), Unit)); // Set up remainder of arguments if there is a prototype. // FIXME: IF NOT, HOW IS THIS REPRESENTED? llvm-gcc doesn't represent '...'! @@ -2414,7 +2414,7 @@ llvm::DICompositeType CGDebugInfo::getOrCreateFunctionType(const Decl *D, SmallVector<llvm::Value *, 16> Elts; // First element is always return type. For 'void' functions it is NULL. - QualType ResultTy = OMethod->getResultType(); + QualType ResultTy = OMethod->getReturnType(); // Replace the instancetype keyword with the actual type. if (ResultTy == CGM.getContext().getObjCInstanceType()) diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 4f0c221450f..8ed30045291 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1718,7 +1718,7 @@ static LValue EmitFunctionDeclLValue(CodeGenFunction &CGF, // isn't the same as the type of a use. Correct for this with a // bitcast. QualType NoProtoType = - CGF.getContext().getFunctionNoProtoType(Proto->getResultType()); + CGF.getContext().getFunctionNoProtoType(Proto->getReturnType()); NoProtoType = CGF.getContext().getPointerType(NoProtoType); V = CGF.Builder.CreateBitCast(V, CGF.ConvertType(NoProtoType)); } @@ -3072,7 +3072,7 @@ LValue CodeGenFunction::EmitObjCMessageExprLValue(const ObjCMessageExpr *E) { if (!RV.isScalar()) return MakeAddrLValue(RV.getAggregateAddr(), E->getType()); - assert(E->getMethodDecl()->getResultType()->isReferenceType() && + assert(E->getMethodDecl()->getReturnType()->isReferenceType() && "Can't have a scalar return unless the return type is a " "reference type!"); diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 12b953b3334..1e49d4ffd38 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -119,8 +119,8 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, // type of MD and has a prefix. // For now we just avoid devirtualizing these covariant cases. if (DevirtualizedMethod && - DevirtualizedMethod->getResultType().getCanonicalType() != - MD->getResultType().getCanonicalType()) + DevirtualizedMethod->getReturnType().getCanonicalType() != + MD->getReturnType().getCanonicalType()) DevirtualizedMethod = NULL; } diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index a4e0eeb9f07..73c4bae7dbd 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -246,7 +246,7 @@ public: } Value *VisitObjCMessageExpr(ObjCMessageExpr *E) { if (E->getMethodDecl() && - E->getMethodDecl()->getResultType()->isReferenceType()) + E->getMethodDecl()->getReturnType()->isReferenceType()) return EmitLoadOfLValue(E); return CGF.EmitObjCMessageExpr(E).getScalarVal(); } diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index aa990143ac2..9c23ba4b1ee 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -79,10 +79,10 @@ CodeGenFunction::EmitObjCBoxedExpr(const ObjCBoxedExpr *E) { RValue RV = EmitAnyExpr(SubExpr); CallArgList Args; Args.add(RV, ArgQT); - - RValue result = Runtime.GenerateMessageSend(*this, ReturnValueSlot(), - BoxingMethod->getResultType(), Sel, Receiver, Args, - ClassDecl, BoxingMethod); + + RValue result = Runtime.GenerateMessageSend( + *this, ReturnValueSlot(), BoxingMethod->getReturnType(), Sel, Receiver, + Args, ClassDecl, BoxingMethod); return Builder.CreateBitCast(result.getScalarVal(), ConvertType(E->getType())); } @@ -186,12 +186,9 @@ llvm::Value *CodeGenFunction::EmitObjCCollectionLiteral(const Expr *E, llvm::Value *Receiver = Runtime.GetClass(*this, Class); // Generate the message send. - RValue result - = Runtime.GenerateMessageSend(*this, ReturnValueSlot(), - MethodWithObjects->getResultType(), - Sel, - Receiver, Args, Class, - MethodWithObjects); + RValue result = Runtime.GenerateMessageSend( + *this, ReturnValueSlot(), MethodWithObjects->getReturnType(), Sel, + Receiver, Args, Class, MethodWithObjects); // The above message send needs these objects, but in ARC they are // passed in a buffer that is essentially __unsafe_unretained. @@ -238,7 +235,7 @@ static RValue AdjustRelatedResultType(CodeGenFunction &CGF, return Result; if (!Method->hasRelatedResultType() || - CGF.getContext().hasSameType(ExpT, Method->getResultType()) || + CGF.getContext().hasSameType(ExpT, Method->getReturnType()) || !Result.isScalar()) return Result; @@ -369,8 +366,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E, shouldExtendReceiverForInnerPointerMessage(E)) Receiver = EmitARCRetainAutorelease(ReceiverType, Receiver); - QualType ResultType = - method ? method->getResultType() : E->getType(); + QualType ResultType = method ? method->getReturnType() : E->getType(); CallArgList Args; EmitCallArgs(Args, method, E->arg_begin(), E->arg_end()); @@ -486,7 +482,7 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD, CurGD = OMD; - StartFunction(OMD, OMD->getResultType(), Fn, FI, args, StartLoc); + StartFunction(OMD, OMD->getReturnType(), Fn, FI, args, StartLoc); // In ARC, certain methods get an extra cleanup. if (CGM.getLangOpts().ObjCAutoRefCount && @@ -904,8 +900,9 @@ CodeGenFunction::generateObjCGetterBody(const ObjCImplementationDecl *classImpl, // We need to fix the type here. Ivars with copy & retain are // always objects so we don't need to worry about complex or // aggregates. - RV = RValue::get(Builder.CreateBitCast(RV.getScalarVal(), - getTypes().ConvertType(getterMethod->getResultType()))); + RV = RValue::get(Builder.CreateBitCast( + RV.getScalarVal(), + getTypes().ConvertType(getterMethod->getReturnType()))); EmitReturnOfRValue(RV, propType); @@ -956,8 +953,8 @@ CodeGenFunction::generateObjCGetterBody(const ObjCImplementationDecl *classImpl, } value = Builder.CreateBitCast(value, ConvertType(propType)); - value = Builder.CreateBitCast(value, - ConvertType(GetterMethodDecl->getResultType())); + value = Builder.CreateBitCast( + value, ConvertType(GetterMethodDecl->getReturnType())); } EmitReturnOfRValue(RValue::get(value), propType); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 239c4e27336..b9d3698046c 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1878,8 +1878,8 @@ CGObjCCommonMac::EmitMessageSend(CodeGen::CodeGenFunction &CGF, MessageSendInfo MSI = getMessageSendInfo(Method, ResultType, ActualArgs); if (Method) - assert(CGM.getContext().getCanonicalType(Method->getResultType()) == - CGM.getContext().getCanonicalType(ResultType) && + assert(CGM.getContext().getCanonicalType(Method->getReturnType()) == + CGM.getContext().getCanonicalType(ResultType) && "Result type mismatch!"); NullReturnState nullReturn; diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 2edce5d27dd..6766aac0718 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -175,7 +175,7 @@ void CodeGenFunction::GenerateVarArgsThunk( GlobalDecl GD, const ThunkInfo &Thunk) { const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl()); const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); - QualType ResultType = FPT->getResultType(); + QualType ResultType = FPT->getReturnType(); // Get the original function assert(FnInfo.isVariadic()); @@ -246,7 +246,7 @@ void CodeGenFunction::StartThunk(llvm::Function *Fn, GlobalDecl GD, QualType ThisType = MD->getThisType(getContext()); const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); QualType ResultType = - CGM.getCXXABI().HasThisReturn(GD) ? ThisType : FPT->getResultType(); + CGM.getCXXABI().HasThisReturn(GD) ? ThisType : FPT->getReturnType(); FunctionArgList FunctionArgs; // Create the implicit 'this' parameter declaration. @@ -317,7 +317,7 @@ void CodeGenFunction::EmitCallAndReturnForThunk(GlobalDecl GD, // Determine whether we have a return value slot to use. QualType ResultType = - CGM.getCXXABI().HasThisReturn(GD) ? ThisType : FPT->getResultType(); + CGM.getCXXABI().HasThisReturn(GD) ? ThisType : FPT->getReturnType(); ReturnValueSlot Slot; if (!ResultType->isVoidType() && CurFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect && diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index db629bf4920..572f5babd0a 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -704,7 +704,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, DebugInfo = NULL; // disable debug info indefinitely for this function FunctionArgList Args; - QualType ResTy = FD->getResultType(); + QualType ResTy = FD->getReturnType(); CurGD = GD; const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); @@ -769,7 +769,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // If the '}' that terminates a function is reached, and the value of the // function call is used by the caller, the behavior is undefined. if (getLangOpts().CPlusPlus && !FD->hasImplicitReturnZero() && - !FD->getResultType()->isVoidType() && Builder.GetInsertBlock()) { + !FD->getReturnType()->isVoidType() && Builder.GetInsertBlock()) { if (SanOpts->Return) EmitCheck(Builder.getFalse(), "missing_return", EmitCheckSourceLocation(FD->getLocation()), @@ -1449,7 +1449,7 @@ void CodeGenFunction::EmitVariablyModifiedType(QualType type) { case Type::FunctionProto: case Type::FunctionNoProto: - type = cast<FunctionType>(ty)->getResultType(); + type = cast<FunctionType>(ty)->getReturnType(); break; case Type::Paren: diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 02b3a10fa56..e84a40d74ae 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -221,7 +221,7 @@ bool CodeGenTypes::isFuncParamTypeConvertible(QualType Ty) { /// pended. If so, we don't want to ask the ABI lowering code to handle a type /// that cannot be converted to an IR type. bool CodeGenTypes::isFuncTypeConvertible(const FunctionType *FT) { - if (!isFuncParamTypeConvertible(FT->getResultType())) + if (!isFuncParamTypeConvertible(FT->getReturnType())) return false; if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) @@ -478,7 +478,7 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { // Force conversion of all the relevant record types, to make sure // we re-convert the FunctionType when appropriate. - if (const RecordType *RT = FT->getResultType()->getAs<RecordType>()) + if (const RecordType *RT = FT->getReturnType()->getAs<RecordType>()) ConvertRecordDeclType(RT->getDecl()); if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) for (unsigned i = 0, e = FPT->getNumParams(); i != e; i++) diff --git a/lib/Index/USRGeneration.cpp b/lib/Index/USRGeneration.cpp index 6bc0dab757a..d71f6d5acdd 100644 --- a/lib/Index/USRGeneration.cpp +++ b/lib/Index/USRGeneration.cpp @@ -627,7 +627,7 @@ void USRGenerator::VisitType(QualType T) { } if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) { Out << 'F'; - VisitType(FT->getResultType()); + VisitType(FT->getReturnType()); for (FunctionProtoType::param_type_iterator I = FT->param_type_begin(), E = FT->param_type_end(); I != E; ++I) { diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index a4b60992a58..4cf87e5d9ac 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -104,7 +104,7 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, DefinitionKind == FDK_Definition && !D.getDeclSpec().isConstexprSpecified() && !(FnD && FnD->getAsFunction() && - FnD->getAsFunction()->getResultType()->getContainedAutoType()) && + FnD->getAsFunction()->getReturnType()->getContainedAutoType()) && ((Actions.CurContext->isDependentContext() || (TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate && TemplateInfo.Kind != ParsedTemplateInfo::ExplicitSpecialization)) && diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp index 759e57e32b5..9b86492051a 100644 --- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp +++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp @@ -976,7 +976,7 @@ void RewriteModernObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // return objc_getProperty(self, _cmd, offsetof(ClassDecl, OID), 1) Getr += "typedef "; const FunctionType *FPRetType = 0; - RewriteTypeIntoString(PD->getGetterMethodDecl()->getResultType(), Getr, + RewriteTypeIntoString(PD->getGetterMethodDecl()->getReturnType(), Getr, FPRetType); Getr += " _TYPE"; if (FPRetType) { @@ -1259,8 +1259,8 @@ void RewriteModernObjC::RewriteTypeIntoString(QualType T, std::string &ResultStr else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>()) PointeeTy = BPT->getPointeeType(); if ((FPRetType = PointeeTy->getAs<FunctionType>())) { - ResultStr += FPRetType->getResultType().getAsString( - Context->getPrintingPolicy()); + ResultStr += + FPRetType->getReturnType().getAsString(Context->getPrintingPolicy()); ResultStr += "(*"; } } else @@ -1273,7 +1273,7 @@ void RewriteModernObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl, //fprintf(stderr,"In RewriteObjCMethodDecl\n"); const FunctionType *FPRetType = 0; ResultStr += "\nstatic "; - RewriteTypeIntoString(OMD->getResultType(), ResultStr, FPRetType); + RewriteTypeIntoString(OMD->getReturnType(), ResultStr, FPRetType); ResultStr += " "; // Unique method name @@ -2272,7 +2272,7 @@ void RewriteModernObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { proto = dyn_cast<FunctionProtoType>(funcType); if (!proto) return; - Type = proto->getResultType(); + Type = proto->getReturnType(); } else if (FieldDecl *FD = dyn_cast<FieldDecl>(Dcl)) { Loc = FD->getLocation(); @@ -2446,7 +2446,7 @@ void RewriteModernObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(funcType); if (!proto) return; - QualType Type = proto->getResultType(); + QualType Type = proto->getReturnType(); std::string FdStr = Type.getAsString(Context->getPrintingPolicy()); FdStr += " "; FdStr += FD->getName(); @@ -2765,9 +2765,8 @@ Stmt *RewriteModernObjC::RewriteObjCBoxedExpr(ObjCBoxedExpr *Exp) { ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *CE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, - EndLoc); + CallExpr *CE = new (Context) + CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc); ReplaceStmt(Exp, CE); return CE; } @@ -2902,9 +2901,8 @@ Stmt *RewriteModernObjC::RewriteObjCArrayLiteralExpr(ObjCArrayLiteral *Exp) { ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *CE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, - EndLoc); + CallExpr *CE = new (Context) + CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc); ReplaceStmt(Exp, CE); return CE; } @@ -3075,9 +3073,8 @@ Stmt *RewriteModernObjC::RewriteObjCDictionaryLiteralExpr(ObjCDictionaryLiteral ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *CE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, - EndLoc); + CallExpr *CE = new (Context) + CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc); ReplaceStmt(Exp, CE); return CE; } @@ -3334,7 +3331,7 @@ Stmt *RewriteModernObjC::SynthMessageExpr(ObjCMessageExpr *Exp, // May need to use objc_msgSend_stret() as well. FunctionDecl *MsgSendStretFlavor = 0; if (ObjCMethodDecl *mDecl = Exp->getMethodDecl()) { - QualType resultType = mDecl->getResultType(); + QualType resultType = mDecl->getReturnType(); if (resultType->isRecordType()) MsgSendStretFlavor = MsgSendStretFunctionDecl; else if (resultType->isRealFloatingType()) @@ -3680,8 +3677,8 @@ Stmt *RewriteModernObjC::SynthMessageExpr(ObjCMessageExpr *Exp, ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *CE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, EndLoc); + CallExpr *CE = new (Context) + CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc); Stmt *ReplacingStmt = CE; if (MsgSendStretFlavor) { // We have the method which returns a struct/union. Must also generate @@ -4226,7 +4223,7 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName, std::string Tag) { const FunctionType *AFT = CE->getFunctionType(); - QualType RT = AFT->getResultType(); + QualType RT = AFT->getReturnType(); std::string StructRef = "struct " + Tag; SourceLocation BlockLoc = CE->getExprLoc(); std::string S; @@ -4731,7 +4728,7 @@ QualType RewriteModernObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) // FTP will be null for closures that don't take arguments. // Generate a funky cast. SmallVector<QualType, 8> ArgTypes; - QualType Res = FT->getResultType(); + QualType Res = FT->getReturnType(); bool modified = convertObjCTypeToCStyleType(Res); if (FTP) { diff --git a/lib/Rewrite/Frontend/RewriteObjC.cpp b/lib/Rewrite/Frontend/RewriteObjC.cpp index 48649574c03..b7f54a8c8d3 100644 --- a/lib/Rewrite/Frontend/RewriteObjC.cpp +++ b/lib/Rewrite/Frontend/RewriteObjC.cpp @@ -810,7 +810,7 @@ void RewriteObjC::RewritePropertyImplDecl(ObjCPropertyImplDecl *PID, // return objc_getProperty(self, _cmd, offsetof(ClassDecl, OID), 1) Getr += "typedef "; const FunctionType *FPRetType = 0; - RewriteTypeIntoString(PD->getGetterMethodDecl()->getResultType(), Getr, + RewriteTypeIntoString(PD->getGetterMethodDecl()->getReturnType(), Getr, FPRetType); Getr += " _TYPE"; if (FPRetType) { @@ -1063,8 +1063,8 @@ void RewriteObjC::RewriteTypeIntoString(QualType T, std::string &ResultStr, else if (const BlockPointerType *BPT = retType->getAs<BlockPointerType>()) PointeeTy = BPT->getPointeeType(); if ((FPRetType = PointeeTy->getAs<FunctionType>())) { - ResultStr += FPRetType->getResultType().getAsString( - Context->getPrintingPolicy()); + ResultStr += + FPRetType->getReturnType().getAsString(Context->getPrintingPolicy()); ResultStr += "(*"; } } else @@ -1077,7 +1077,7 @@ void RewriteObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl, //fprintf(stderr,"In RewriteObjCMethodDecl\n"); const FunctionType *FPRetType = 0; ResultStr += "\nstatic "; - RewriteTypeIntoString(OMD->getResultType(), ResultStr, FPRetType); + RewriteTypeIntoString(OMD->getReturnType(), ResultStr, FPRetType); ResultStr += " "; // Unique method name @@ -2162,7 +2162,7 @@ void RewriteObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) { proto = dyn_cast<FunctionProtoType>(funcType); if (!proto) return; - Type = proto->getResultType(); + Type = proto->getReturnType(); } else if (FieldDecl *FD = dyn_cast<FieldDecl>(Dcl)) { Loc = FD->getLocation(); @@ -2333,7 +2333,7 @@ void RewriteObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(funcType); if (!proto) return; - QualType Type = proto->getResultType(); + QualType Type = proto->getReturnType(); std::string FdStr = Type.getAsString(Context->getPrintingPolicy()); FdStr += " "; FdStr += FD->getName(); @@ -2650,9 +2650,8 @@ CallExpr *RewriteObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFlavo ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *STCE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, - SourceLocation()); + CallExpr *STCE = new (Context) CallExpr( + *Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, SourceLocation()); return STCE; } @@ -2685,7 +2684,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, // May need to use objc_msgSend_stret() as well. FunctionDecl *MsgSendStretFlavor = 0; if (ObjCMethodDecl *mDecl = Exp->getMethodDecl()) { - QualType resultType = mDecl->getResultType(); + QualType resultType = mDecl->getReturnType(); if (resultType->isRecordType()) MsgSendStretFlavor = MsgSendStretFunctionDecl; else if (resultType->isRealFloatingType()) @@ -3034,9 +3033,8 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, ParenExpr *PE = new (Context) ParenExpr(StartLoc, EndLoc, cast); const FunctionType *FT = msgSendType->getAs<FunctionType>(); - CallExpr *CE = new (Context) CallExpr(*Context, PE, MsgExprs, - FT->getResultType(), VK_RValue, - EndLoc); + CallExpr *CE = new (Context) + CallExpr(*Context, PE, MsgExprs, FT->getReturnType(), VK_RValue, EndLoc); Stmt *ReplacingStmt = CE; if (MsgSendStretFlavor) { // We have the method which returns a struct/union. Must also generate @@ -3330,7 +3328,7 @@ std::string RewriteObjC::SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName, std::string Tag) { const FunctionType *AFT = CE->getFunctionType(); - QualType RT = AFT->getResultType(); + QualType RT = AFT->getReturnType(); std::string StructRef = "struct " + Tag; std::string S = "static " + RT.getAsString(Context->getPrintingPolicy()) + " __" + funcName.str() + "_" + "block_func_" + utostr(i); @@ -3787,7 +3785,7 @@ QualType RewriteObjC::convertFunctionTypeOfBlocks(const FunctionType *FT) { // FTP will be null for closures that don't take arguments. // Generate a funky cast. SmallVector<QualType, 8> ArgTypes; - QualType Res = FT->getResultType(); + QualType Res = FT->getReturnType(); bool HasBlockType = convertBlockPointerToFunctionPointer(Res); if (FTP) { diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 9864072b722..b13831908b4 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -431,18 +431,18 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body, bool HasNoReturn = false; if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - ReturnsVoid = FD->getResultType()->isVoidType(); + ReturnsVoid = FD->getReturnType()->isVoidType(); HasNoReturn = FD->isNoReturn(); } else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) { - ReturnsVoid = MD->getResultType()->isVoidType(); + ReturnsVoid = MD->getReturnType()->isVoidType(); HasNoReturn = MD->hasAttr<NoReturnAttr>(); } else if (isa<BlockDecl>(D)) { QualType BlockTy = blkExpr->getType(); if (const FunctionType *FT = BlockTy->getPointeeType()->getAs<FunctionType>()) { - if (FT->getResultType()->isVoidType()) + if (FT->getReturnType()->isVoidType()) ReturnsVoid = true; if (FT->getNoReturnAttr()) HasNoReturn = true; diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 0d944708d2d..3a5f8453cf1 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -1240,7 +1240,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, ZeroArgCallReturnTy = QualType(); Ambiguous = true; } else - ZeroArgCallReturnTy = OverloadDecl->getResultType(); + ZeroArgCallReturnTy = OverloadDecl->getReturnType(); } } } @@ -1269,7 +1269,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, if (const DeclRefExpr *DeclRef = dyn_cast<DeclRefExpr>(E.IgnoreParens())) { if (const FunctionDecl *Fun = dyn_cast<FunctionDecl>(DeclRef->getDecl())) { if (Fun->getMinRequiredArguments() == 0) - ZeroArgCallReturnTy = Fun->getResultType(); + ZeroArgCallReturnTy = Fun->getReturnType(); return true; } } @@ -1287,7 +1287,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, if (const FunctionProtoType *FPT = dyn_cast_or_null<FunctionProtoType>(FunTy)) { if (FPT->getNumParams() == 0) - ZeroArgCallReturnTy = FunTy->getResultType(); + ZeroArgCallReturnTy = FunTy->getReturnType(); return true; } return false; @@ -1338,7 +1338,7 @@ static void notePlausibleOverloads(Sema &S, SourceLocation Loc, for (OverloadExpr::decls_iterator It = Overloads.begin(), DeclsEnd = Overloads.end(); It != DeclsEnd; ++It) { const FunctionDecl *OverloadDecl = cast<FunctionDecl>(*It); - QualType OverloadResultTy = OverloadDecl->getResultType(); + QualType OverloadResultTy = OverloadDecl->getReturnType(); if (IsPlausibleResult(OverloadResultTy)) PlausibleOverloads.addDecl(It.getDecl()); } diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp index 7b0eaaac39f..47aea375939 100644 --- a/lib/Sema/SemaAccess.cpp +++ b/lib/Sema/SemaAccess.cpp @@ -379,9 +379,8 @@ static bool MightInstantiateTo(Sema &S, if (FriendTy->getNumParams() != ContextTy->getNumParams()) return false; - if (!MightInstantiateTo(S, - ContextTy->getResultType(), - FriendTy->getResultType())) + if (!MightInstantiateTo(S, ContextTy->getReturnType(), + FriendTy->getReturnType())) return false; for (unsigned I = 0, E = FriendTy->getNumParams(); I != E; ++I) diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 472ae4de8dc..3e6b39a09b3 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2946,7 +2946,7 @@ bool CheckPrintfHandler::checkForCStrMembers( MI != ME; ++MI) { const CXXMethodDecl *Method = *MI; if (Method->getNumParams() == 0 && - AT.matchesType(S.Context, Method->getResultType())) { + AT.matchesType(S.Context, Method->getReturnType())) { // FIXME: Suggest parens if the expression needs them. SourceLocation EndLoc = S.getPreprocessor().getLocForEndOfToken(E->getLocEnd()); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 33909c73077..78dd5cd3055 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -697,7 +697,7 @@ QualType clang::getDeclUsageType(ASTContext &C, const NamedDecl *ND) { } if (const FunctionType *Function = T->getAs<FunctionType>()) { - T = Function->getResultType(); + T = Function->getReturnType(); continue; } @@ -1781,10 +1781,10 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // know the function is void or not. bool isVoid = false; if (FunctionDecl *Function = dyn_cast<FunctionDecl>(SemaRef.CurContext)) - isVoid = Function->getResultType()->isVoidType(); + isVoid = Function->getReturnType()->isVoidType(); else if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(SemaRef.CurContext)) - isVoid = Method->getResultType()->isVoidType(); + isVoid = Method->getReturnType()->isVoidType(); else if (SemaRef.getCurBlock() && !SemaRef.getCurBlock()->ReturnType.isNull()) isVoid = SemaRef.getCurBlock()->ReturnType->isVoidType(); @@ -2065,9 +2065,9 @@ static void AddResultTypeChunk(ASTContext &Context, // Determine the type of the declaration (if it has a type). QualType T; if (const FunctionDecl *Function = ND->getAsFunction()) - T = Function->getResultType(); + T = Function->getReturnType(); else if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(ND)) - T = Method->getResultType(); + T = Method->getReturnType(); else if (const EnumConstantDecl *Enumerator = dyn_cast<EnumConstantDecl>(ND)) T = Context.getTypeDeclType(cast<TypeDecl>(Enumerator->getDeclContext())); else if (isa<UnresolvedUsingValueDecl>(ND)) { @@ -2200,7 +2200,7 @@ static std::string FormatFunctionParameter(ASTContext &Context, // We have the function prototype behind the block pointer type, as it was // written in the source. std::string Result; - QualType ResultType = Block.getTypePtr()->getResultType(); + QualType ResultType = Block.getTypePtr()->getReturnType(); if (!ResultType->isVoidType() || SuppressBlock) ResultType.getAsStringInternal(Result, Policy); @@ -2830,9 +2830,8 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( // Function without a prototype. Just give the return type and a // highlighted ellipsis. const FunctionType *FT = getFunctionType(); - Result.AddTextChunk(GetCompletionTypeString(FT->getResultType(), - S.Context, Policy, - Result.getAllocator())); + Result.AddTextChunk(GetCompletionTypeString(FT->getReturnType(), S.Context, + Policy, Result.getAllocator())); Result.AddChunk(CodeCompletionString::CK_LeftParen); Result.AddChunk(CodeCompletionString::CK_CurrentParameter, "..."); Result.AddChunk(CodeCompletionString::CK_RightParen); @@ -2843,10 +2842,9 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString( Result.AddTextChunk( Result.getAllocator().CopyString(FDecl->getNameAsString())); else - Result.AddTextChunk( - Result.getAllocator().CopyString( - Proto->getResultType().getAsString(Policy))); - + Result.AddTextChunk(Result.getAllocator().CopyString( + Proto->getReturnType().getAsString(Policy))); + Result.AddChunk(CodeCompletionString::CK_LeftParen); unsigned NumParams = FDecl ? FDecl->getNumParams() : Proto->getNumParams(); for (unsigned I = 0; I != NumParams; ++I) { @@ -3977,10 +3975,10 @@ void Sema::CodeCompleteReturn(Scope *S) { if (BlockScopeInfo *BSI = getCurBlock()) ResultType = BSI->ReturnType; } else if (FunctionDecl *Function = dyn_cast<FunctionDecl>(CurContext)) - ResultType = Function->getResultType(); + ResultType = Function->getReturnType(); else if (ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(CurContext)) - ResultType = Method->getResultType(); - + ResultType = Method->getReturnType(); + if (ResultType.isNull()) CodeCompleteOrdinaryName(S, PCC_Expression); else @@ -6196,7 +6194,7 @@ static void FindImplementableMethods(ASTContext &Context, M != MEnd; ++M) { if (M->isInstanceMethod() == WantInstanceMethods) { if (!ReturnType.isNull() && - !Context.hasSameUnqualifiedType(ReturnType, M->getResultType())) + !Context.hasSameUnqualifiedType(ReturnType, M->getReturnType())) continue; KnownMethods[M->getSelector()] = @@ -6921,10 +6919,9 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, // If the result type was not already provided, add it to the // pattern as (type). if (ReturnType.isNull()) - AddObjCPassingTypeChunk(Method->getResultType(), - Method->getObjCDeclQualifier(), - Context, Policy, - Builder); + AddObjCPassingTypeChunk(Method->getReturnType(), + Method->getObjCDeclQualifier(), Context, Policy, + Builder); Selector Sel = Method->getSelector(); @@ -6968,7 +6965,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); Builder.AddChunk(CodeCompletionString::CK_LeftBrace); Builder.AddChunk(CodeCompletionString::CK_VerticalSpace); - if (!Method->getResultType()->isVoidType()) { + if (!Method->getReturnType()->isVoidType()) { // If the result type is not void, add a return clause. Builder.AddTextChunk("return"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4b82dd35aa1..33cb77fa14f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2444,12 +2444,14 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, // Redeclarations or specializations of a function or function template // with a declared return type that uses a placeholder type shall also // use that placeholder, not a deduced type. - QualType OldDeclaredReturnType = (Old->getTypeSourceInfo() - ? Old->getTypeSourceInfo()->getType()->castAs<FunctionType>() - : OldType)->getResultType(); - QualType NewDeclaredReturnType = (New->getTypeSourceInfo() - ? New->getTypeSourceInfo()->getType()->castAs<FunctionType>() - : NewType)->getResultType(); + QualType OldDeclaredReturnType = + (Old->getTypeSourceInfo() + ? Old->getTypeSourceInfo()->getType()->castAs<FunctionType>() + : OldType)->getReturnType(); + QualType NewDeclaredReturnType = + (New->getTypeSourceInfo() + ? New->getTypeSourceInfo()->getType()->castAs<FunctionType>() + : NewType)->getReturnType(); QualType ResQT; if (!Context.hasSameType(OldDeclaredReturnType, NewDeclaredReturnType) && !((NewQType->isDependentType() || OldQType->isDependentType()) && @@ -2470,12 +2472,12 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, NewQType = ResQT; } - QualType OldReturnType = OldType->getResultType(); - QualType NewReturnType = cast<FunctionType>(NewQType)->getResultType(); + QualType OldReturnType = OldType->getReturnType(); + QualType NewReturnType = cast<FunctionType>(NewQType)->getReturnType(); if (OldReturnType != NewReturnType) { // If this function has a deduced return type and has already been // defined, copy the deduced value from the old declaration. - AutoType *OldAT = Old->getResultType()->getContainedAutoType(); + AutoType *OldAT = Old->getReturnType()->getContainedAutoType(); if (OldAT && OldAT->isDeduced()) { New->setType( SubstAutoType(New->getType(), @@ -2642,9 +2644,9 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, assert(!OldProto->hasExceptionSpec() && "Exception spec in C"); SmallVector<QualType, 16> ParamTypes(OldProto->param_type_begin(), OldProto->param_type_end()); - NewQType = Context.getFunctionType(NewFuncType->getResultType(), - ParamTypes, - OldProto->getExtProtoInfo()); + NewQType = + Context.getFunctionType(NewFuncType->getReturnType(), ParamTypes, + OldProto->getExtProtoInfo()); New->setType(NewQType); New->setHasInheritedPrototype(); @@ -2694,8 +2696,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, Scope *S, = New->getType()->getAs<FunctionProtoType>(); // Determine whether this is the GNU C extension. - QualType MergedReturn = Context.mergeTypes(OldProto->getResultType(), - NewProto->getResultType()); + QualType MergedReturn = Context.mergeTypes(OldProto->getReturnType(), + NewProto->getReturnType()); bool LooseCompatible = !MergedReturn.isNull(); for (unsigned Idx = 0, End = Old->getNumParams(); LooseCompatible && Idx != End; ++Idx) { @@ -6223,10 +6225,9 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // For record types, this is done by the AbstractClassUsageDiagnoser once // the class has been completely parsed. if (!DC->isRecord() && - SemaRef.RequireNonAbstractType(D.getIdentifierLoc(), - R->getAs<FunctionType>()->getResultType(), - diag::err_abstract_type_in_decl, - SemaRef.AbstractReturnType)) + SemaRef.RequireNonAbstractType( + D.getIdentifierLoc(), R->getAs<FunctionType>()->getReturnType(), + diag::err_abstract_type_in_decl, SemaRef.AbstractReturnType)) D.setInvalidType(); if (Name.getNameKind() == DeclarationName::CXXConstructorName) { @@ -6711,14 +6712,14 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } if (getLangOpts().CPlusPlus1y && - NewFD->getResultType()->isUndeducedType()) + NewFD->getReturnType()->isUndeducedType()) Diag(D.getDeclSpec().getVirtualSpecLoc(), diag::err_auto_fn_virtual); } if (getLangOpts().CPlusPlus1y && (NewFD->isDependentContext() || (isFriend && CurContext->isDependentContext())) && - NewFD->getResultType()->isUndeducedType()) { + NewFD->getReturnType()->isUndeducedType()) { // If the function template is referenced directly (for instance, as a // member of the current instantiation), pretend it has a dependent type. // This is not really justified by the standard, but is the only sane @@ -6727,8 +6728,8 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // a friend yet, so 'isDependentContext' on the FD doesn't work. const FunctionProtoType *FPT = NewFD->getType()->castAs<FunctionProtoType>(); - QualType Result = SubstAutoType(FPT->getResultType(), - Context.DependentTy); + QualType Result = + SubstAutoType(FPT->getReturnType(), Context.DependentTy); NewFD->setType(Context.getFunctionType(Result, FPT->getParamTypes(), FPT->getExtProtoInfo())); } @@ -6849,7 +6850,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, getLangOpts().CPlusPlus11 && FPT && !FPT->hasExceptionSpec()) { FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExceptionSpecType = EST_BasicNoexcept; - NewFD->setType(Context.getFunctionType(FPT->getResultType(), + NewFD->setType(Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); } } @@ -6947,7 +6948,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Functions returning a variably modified type violate C99 6.7.5.2p2 // because all functions have linkage. if (!NewFD->isInvalidDecl() && - NewFD->getResultType()->isVariablyModifiedType()) { + NewFD->getReturnType()->isVariablyModifiedType()) { Diag(NewFD->getLocation(), diag::err_vm_func_decl); NewFD->setInvalidDecl(); } @@ -6955,7 +6956,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Handle attributes. ProcessDeclAttributes(S, NewFD, D); - QualType RetType = NewFD->getResultType(); + QualType RetType = NewFD->getReturnType(); const CXXRecordDecl *Ret = RetType->isRecordType() ? RetType->getAsCXXRecordDecl() : RetType->getPointeeCXXRecordDecl(); if (!NewFD->isInvalidDecl() && !NewFD->hasAttr<WarnUnusedResultAttr>() && @@ -7262,7 +7263,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, EPI.Variadic = true; EPI.ExtInfo = FT->getExtInfo(); - QualType R = Context.getFunctionType(FT->getResultType(), None, EPI); + QualType R = Context.getFunctionType(FT->getReturnType(), None, EPI); NewFD->setType(R); } @@ -7301,7 +7302,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, } // OpenCL v1.2, s6.9 -- Kernels can only have return type void. - if (!NewFD->getResultType()->isVoidType()) { + if (!NewFD->getReturnType()->isVoidType()) { Diag(D.getIdentifierLoc(), diag::err_expected_kernel_void_return_type); D.setInvalidType(); @@ -7322,7 +7323,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (!NewFD->isInvalidDecl() && NewFD->getDeclContext()->getRedeclContext()->isTranslationUnit()) { if (II->isStr("cudaConfigureCall")) { - if (!R->getAs<FunctionType>()->getResultType()->isScalarType()) + if (!R->getAs<FunctionType>()->getReturnType()->isScalarType()) Diag(NewFD->getLocation(), diag::err_config_scalar_return); Context.setcudaConfigureCallDecl(NewFD); @@ -7364,8 +7365,8 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsExplicitSpecialization) { - assert(!NewFD->getResultType()->isVariablyModifiedType() - && "Variably modified return types are not handled here"); + assert(!NewFD->getReturnType()->isVariablyModifiedType() && + "Variably modified return types are not handled here"); // Determine whether the type of this function should be merged with // a previous visible declaration. This never happens for functions in C++, @@ -7475,7 +7476,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, MD->getType()->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; - MD->setType(Context.getFunctionType(FPT->getResultType(), + MD->setType(Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); // Warn that we did this, if we're not performing template instantiation. @@ -7634,7 +7635,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, // compatible, and if it does, warn the user. // But, issue any diagnostic on the first declaration only. if (NewFD->isExternC() && Previous.empty()) { - QualType R = NewFD->getResultType(); + QualType R = NewFD->getReturnType(); if (R->isIncompleteType() && !R->isVoidType()) Diag(NewFD->getLocation(), diag::warn_return_value_udt_incomplete) << NewFD << R; @@ -7704,7 +7705,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { const FunctionType* FT = T->castAs<FunctionType>(); // All the standards say that main() should should return 'int'. - if (Context.hasSameUnqualifiedType(FT->getResultType(), Context.IntTy)) { + if (Context.hasSameUnqualifiedType(FT->getReturnType(), Context.IntTy)) { // In C and C++, main magically returns 0 if you fall off the end; // set the flag which tells us that. // This is C++ [basic.start.main]p5 and C99 5.1.2.2.3. @@ -7809,9 +7810,9 @@ void Sema::CheckMSVCRTEntryPoint(FunctionDecl *FD) { // Set an implicit return of 'zero' if the function can return some integral, // enumeration, pointer or nullptr type. - if (FT->getResultType()->isIntegralOrEnumerationType() || - FT->getResultType()->isAnyPointerType() || - FT->getResultType()->isNullPtrType()) + if (FT->getReturnType()->isIntegralOrEnumerationType() || + FT->getReturnType()->isAnyPointerType() || + FT->getReturnType()->isNullPtrType()) // DllMain is exempt because a return value of zero means it failed. if (FD->getName() != "DllMain") FD->setHasImplicitReturnZero(true); @@ -9447,7 +9448,7 @@ static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator, LambdaScopeInfo *LSI = S.PushLambdaScope(); LSI->CallOperator = CallOperator; LSI->Lambda = LambdaClass; - LSI->ReturnType = CallOperator->getResultType(); + LSI->ReturnType = CallOperator->getReturnType(); const LambdaCaptureDefault LCD = LambdaClass->getLambdaCaptureDefault(); if (LCD == LCD_None) @@ -9530,7 +9531,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { // The return type of a function definition must be complete // (C99 6.9.1p3, C++ [dcl.fct]p6). - QualType ResultType = FD->getResultType(); + QualType ResultType = FD->getReturnType(); if (!ResultType->isDependentType() && !ResultType->isVoidType() && !FD->isInvalidDecl() && RequireCompleteType(FD->getLocation(), ResultType, @@ -9697,7 +9698,7 @@ bool Sema::canSkipFunctionBody(Decl *D) { // We cannot skip the body of a function with an undeduced return type, // because any callers of that function need to know the type. if (const FunctionDecl *FD = D->getAsFunction()) - if (FD->isConstexpr() || FD->getResultType()->isUndeducedType()) + if (FD->isConstexpr() || FD->getReturnType()->isUndeducedType()) return false; return Consumer.shouldSkipFunctionBody(D); } @@ -9725,13 +9726,13 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, FD->setBody(Body); if (getLangOpts().CPlusPlus1y && !FD->isInvalidDecl() && Body && - !FD->isDependentContext() && FD->getResultType()->isUndeducedType()) { + !FD->isDependentContext() && FD->getReturnType()->isUndeducedType()) { // If the function has a deduced result type but contains no 'return' // statements, the result type as written must be exactly 'auto', and // the deduced result type is 'void'. - if (!FD->getResultType()->getAs<AutoType>()) { + if (!FD->getReturnType()->getAs<AutoType>()) { Diag(dcl->getLocation(), diag::err_auto_fn_no_return_but_not_auto) - << FD->getResultType(); + << FD->getReturnType(); FD->setInvalidDecl(); } else { // Substitute 'void' for the 'auto' in the type. @@ -9767,8 +9768,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, if (!FD->isInvalidDecl()) { DiagnoseUnusedParameters(FD->param_begin(), FD->param_end()); DiagnoseSizeOfParametersAndReturnValue(FD->param_begin(), FD->param_end(), - FD->getResultType(), FD); - + FD->getReturnType(), FD); + // If this is a constructor, we need a vtable. if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(FD)) MarkVTableUsed(FD->getLocation(), Constructor->getParent()); @@ -9776,7 +9777,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, // Try to apply the named return value optimization. We have to check // if we can do this here because lambdas keep return statements around // to deduce an implicit return type. - if (getLangOpts().CPlusPlus && FD->getResultType()->isRecordType() && + if (getLangOpts().CPlusPlus && FD->getReturnType()->isRecordType() && !FD->isDependentContext()) computeNRVO(Body, getCurFunction()); } @@ -9789,8 +9790,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, if (!MD->isInvalidDecl()) { DiagnoseUnusedParameters(MD->param_begin(), MD->param_end()); DiagnoseSizeOfParametersAndReturnValue(MD->param_begin(), MD->param_end(), - MD->getResultType(), MD); - + MD->getReturnType(), MD); + if (Body) computeNRVO(Body, getCurFunction()); } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 8af151e78da..0845194a78d 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -89,8 +89,8 @@ static QualType getFunctionOrMethodParamType(const Decl *D, unsigned Idx) { static QualType getFunctionOrMethodResultType(const Decl *D) { if (const FunctionType *FnTy = D->getFunctionType()) - return cast<FunctionProtoType>(FnTy)->getResultType(); - return cast<ObjCMethodDecl>(D)->getResultType(); + return cast<FunctionProtoType>(FnTy)->getReturnType(); + return cast<ObjCMethodDecl>(D)->getReturnType(); } static bool isFunctionOrMethodVariadic(const Decl *D) { @@ -1463,7 +1463,7 @@ static void handleTLSModelAttr(Sema &S, Decl *D, static void handleMallocAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { - QualType RetTy = FD->getResultType(); + QualType RetTy = FD->getReturnType(); if (RetTy->isAnyPointerType() || RetTy->isBlockPointerType()) { D->addAttr(::new (S.Context) MallocAttr(Attr.getRange(), S.Context, @@ -2006,10 +2006,10 @@ static void handleObjCMethodFamilyAttr(Sema &S, Decl *decl, return; } - if (F == ObjCMethodFamilyAttr::OMF_init && - !method->getResultType()->isObjCObjectPointerType()) { + if (F == ObjCMethodFamilyAttr::OMF_init && + !method->getReturnType()->isObjCObjectPointerType()) { S.Diag(method->getLocation(), diag::err_init_method_bad_return_type) - << method->getResultType(); + << method->getReturnType(); // Ignore the attribute. return; } @@ -2167,13 +2167,14 @@ static void handleSentinelAttr(Sema &S, Decl *D, const AttributeList &Attr) { } static void handleWarnUnusedResult(Sema &S, Decl *D, const AttributeList &Attr) { - if (D->getFunctionType() && D->getFunctionType()->getResultType()->isVoidType()) { + if (D->getFunctionType() && + D->getFunctionType()->getReturnType()->isVoidType()) { S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method) << Attr.getName() << 0; return; } if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) - if (MD->getResultType()->isVoidType()) { + if (MD->getReturnType()->isVoidType()) { S.Diag(Attr.getLoc(), diag::warn_attribute_void_function_method) << Attr.getName() << 1; return; @@ -3009,7 +3010,7 @@ static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void handleGlobalAttr(Sema &S, Decl *D, const AttributeList &Attr) { FunctionDecl *FD = cast<FunctionDecl>(D); - if (!FD->getResultType()->isVoidType()) { + if (!FD->getReturnType()->isVoidType()) { TypeLoc TL = FD->getTypeSourceInfo()->getTypeLoc().IgnoreParens(); if (FunctionTypeLoc FTL = TL.getAs<FunctionTypeLoc>()) { S.Diag(FD->getTypeSpecStartLoc(), diag::err_kern_type_not_void_return) @@ -3374,14 +3375,14 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, QualType returnType; if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) - returnType = MD->getResultType(); + returnType = MD->getReturnType(); else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) && (Attr.getKind() == AttributeList::AT_NSReturnsRetained)) return; // ignore: was handled as a type attribute else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) returnType = PD->getType(); else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) - returnType = FD->getResultType(); + returnType = FD->getReturnType(); else { S.Diag(D->getLocStart(), diag::warn_attribute_wrong_decl_type) << Attr.getRange() << Attr.getName() @@ -3452,7 +3453,7 @@ static void handleObjCReturnsInnerPointerAttr(Sema &S, Decl *D, SourceLocation loc = attr.getLoc(); QualType resultType; if (isa<ObjCMethodDecl>(D)) - resultType = cast<ObjCMethodDecl>(D)->getResultType(); + resultType = cast<ObjCMethodDecl>(D)->getReturnType(); else resultType = cast<ObjCPropertyDecl>(D)->getType(); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 019b1c189c2..ad8b1b2ba5c 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -790,7 +790,7 @@ bool Sema::CheckConstexprFunctionDecl(const FunctionDecl *NewFD) { } // - its return type shall be a literal type; - QualType RT = NewFD->getResultType(); + QualType RT = NewFD->getReturnType(); if (!RT->isDependentType() && RequireLiteralType(NewFD->getLocation(), RT, diag::err_constexpr_non_literal_return)) @@ -1180,7 +1180,7 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) { // statement. We still do, unless the return type is void, because // otherwise if there's no return statement, the function cannot // be used in a core constant expression. - bool OK = getLangOpts().CPlusPlus1y && Dcl->getResultType()->isVoidType(); + bool OK = getLangOpts().CPlusPlus1y && Dcl->getReturnType()->isVoidType(); Diag(Dcl->getLocation(), OK ? diag::warn_cxx11_compat_constexpr_body_no_return : diag::err_constexpr_body_no_return); @@ -4717,7 +4717,7 @@ updateExceptionSpec(Sema &S, FunctionDecl *FD, const FunctionProtoType *FPT, const Sema::ImplicitExceptionSpecification &ExceptSpec) { FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); ExceptSpec.getEPI(EPI); - FD->setType(S.Context.getFunctionType(FPT->getResultType(), + FD->setType(S.Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); } @@ -4805,7 +4805,7 @@ void Sema::CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD) { QualType ReturnType = Context.VoidTy; if (CSM == CXXCopyAssignment || CSM == CXXMoveAssignment) { // Check for return type matching. - ReturnType = Type->getResultType(); + ReturnType = Type->getReturnType(); QualType ExpectedReturnType = Context.getLValueReferenceType(Context.getTypeDeclType(RD)); if (!Context.hasSameType(ReturnType, ExpectedReturnType)) { @@ -6221,7 +6221,7 @@ QualType Sema::CheckConstructorDeclarator(Declarator &D, QualType R, // case any of the errors above fired) and with "void" as the // return type, since constructors don't have return types. const FunctionProtoType *Proto = R->getAs<FunctionProtoType>(); - if (Proto->getResultType() == Context.VoidTy && !D.isInvalidType()) + if (Proto->getReturnType() == Context.VoidTy && !D.isInvalidType()) return R; FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); @@ -6469,11 +6469,11 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, // Diagnose "&operator bool()" and other such nonsense. This // is actually a gcc extension which we don't support. - if (Proto->getResultType() != ConvType) { + if (Proto->getReturnType() != ConvType) { Diag(D.getIdentifierLoc(), diag::err_conv_function_with_complex_decl) - << Proto->getResultType(); + << Proto->getReturnType(); D.setInvalidType(); - ConvType = Proto->getResultType(); + ConvType = Proto->getReturnType(); } // C++ [class.conv.fct]p4: @@ -8412,7 +8412,7 @@ private: do declareCtor(UsingLoc, Ctor, SemaRef.Context.getFunctionType( - Ctor->getResultType(), ArgTypes.slice(0, Params), EPI)); + Ctor->getReturnType(), ArgTypes.slice(0, Params), EPI)); while (Params > MinParams && Ctor->getParamDecl(--Params)->hasDefaultArg()); } @@ -8526,7 +8526,7 @@ private: FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.ExceptionSpecType = EST_Unevaluated; EPI.ExceptionSpecDecl = DerivedCtor; - DerivedCtor->setType(Context.getFunctionType(FPT->getResultType(), + DerivedCtor->setType(Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI)); // Build the parameter declarations. @@ -10687,8 +10687,8 @@ CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl, CanQualType ExpectedFirstParamType, unsigned DependentParamTypeDiag, unsigned InvalidParamTypeDiag) { - QualType ResultType = - FnDecl->getType()->getAs<FunctionType>()->getResultType(); + QualType ResultType = + FnDecl->getType()->getAs<FunctionType>()->getReturnType(); // Check that the result type is not dependent. if (ResultType->isDependentType()) @@ -12106,8 +12106,8 @@ bool Sema::CheckOverridingFunctionAttributes(const CXXMethodDecl *New, bool Sema::CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old) { - QualType NewTy = New->getType()->getAs<FunctionType>()->getResultType(); - QualType OldTy = Old->getType()->getAs<FunctionType>()->getResultType(); + QualType NewTy = New->getType()->getAs<FunctionType>()->getReturnType(); + QualType OldTy = Old->getType()->getAs<FunctionType>()->getReturnType(); if (Context.hasSameType(NewTy, OldTy) || NewTy->isDependentType() || OldTy->isDependentType()) diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 78c26d38a9f..7d023e1d403 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -49,8 +49,8 @@ bool Sema::checkInitMethod(ObjCMethodDecl *method, // We ignore protocols here. Should we? What about Class? - const ObjCObjectType *result = method->getResultType() - ->castAs<ObjCObjectPointerType>()->getObjectType(); + const ObjCObjectType *result = + method->getReturnType()->castAs<ObjCObjectPointerType>()->getObjectType(); if (result->isObjCId()) { return false; @@ -118,10 +118,10 @@ void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, // implies a related result type, and the original (overridden) method has // a suitable return type, but the new (overriding) method does not have // a suitable return type. - QualType ResultType = NewMethod->getResultType(); + QualType ResultType = NewMethod->getReturnType(); SourceRange ResultTypeRange; - if (const TypeSourceInfo *ResultTypeInfo - = NewMethod->getResultTypeSourceInfo()) + if (const TypeSourceInfo *ResultTypeInfo = + NewMethod->getReturnTypeSourceInfo()) ResultTypeRange = ResultTypeInfo->getTypeLoc().getSourceRange(); // Figure out which class this method is part of, if any. @@ -209,19 +209,19 @@ bool Sema::CheckARCMethodDecl(ObjCMethodDecl *method) { return false; case OMF_dealloc: - if (!Context.hasSameType(method->getResultType(), Context.VoidTy)) { + if (!Context.hasSameType(method->getReturnType(), Context.VoidTy)) { SourceRange ResultTypeRange; - if (const TypeSourceInfo *ResultTypeInfo - = method->getResultTypeSourceInfo()) + if (const TypeSourceInfo *ResultTypeInfo = + method->getReturnTypeSourceInfo()) ResultTypeRange = ResultTypeInfo->getTypeLoc().getSourceRange(); if (ResultTypeRange.isInvalid()) - Diag(method->getLocation(), diag::error_dealloc_bad_result_type) - << method->getResultType() - << FixItHint::CreateInsertion(method->getSelectorLoc(0), "(void)"); + Diag(method->getLocation(), diag::error_dealloc_bad_result_type) + << method->getReturnType() + << FixItHint::CreateInsertion(method->getSelectorLoc(0), "(void)"); else - Diag(method->getLocation(), diag::error_dealloc_bad_result_type) - << method->getResultType() - << FixItHint::CreateReplacement(ResultTypeRange, "void"); + Diag(method->getLocation(), diag::error_dealloc_bad_result_type) + << method->getReturnType() + << FixItHint::CreateReplacement(ResultTypeRange, "void"); return true; } return false; @@ -1341,21 +1341,21 @@ static bool CheckMethodOverrideReturn(Sema &S, (MethodDecl->getObjCDeclQualifier() != MethodImpl->getObjCDeclQualifier())) { if (Warn) { - S.Diag(MethodImpl->getLocation(), - (IsOverridingMode ? - diag::warn_conflicting_overriding_ret_type_modifiers - : diag::warn_conflicting_ret_type_modifiers)) + S.Diag(MethodImpl->getLocation(), + (IsOverridingMode + ? diag::warn_conflicting_overriding_ret_type_modifiers + : diag::warn_conflicting_ret_type_modifiers)) << MethodImpl->getDeclName() - << getTypeRange(MethodImpl->getResultTypeSourceInfo()); - S.Diag(MethodDecl->getLocation(), diag::note_previous_declaration) - << getTypeRange(MethodDecl->getResultTypeSourceInfo()); + << getTypeRange(MethodImpl->getReturnTypeSourceInfo()); + S.Diag(MethodDecl->getLocation(), diag::note_previous_declaration) + << getTypeRange(MethodDecl->getReturnTypeSourceInfo()); } else return false; } - - if (S.Context.hasSameUnqualifiedType(MethodImpl->getResultType(), - MethodDecl->getResultType())) + + if (S.Context.hasSameUnqualifiedType(MethodImpl->getReturnType(), + MethodDecl->getReturnType())) return true; if (!Warn) return false; @@ -1367,9 +1367,9 @@ static bool CheckMethodOverrideReturn(Sema &S, // Mismatches between ObjC pointers go into a different warning // category, and sometimes they're even completely whitelisted. if (const ObjCObjectPointerType *ImplPtrTy = - MethodImpl->getResultType()->getAs<ObjCObjectPointerType>()) { + MethodImpl->getReturnType()->getAs<ObjCObjectPointerType>()) { if (const ObjCObjectPointerType *IfacePtrTy = - MethodDecl->getResultType()->getAs<ObjCObjectPointerType>()) { + MethodDecl->getReturnType()->getAs<ObjCObjectPointerType>()) { // Allow non-matching return types as long as they don't violate // the principle of substitutability. Specifically, we permit // return types that are subclasses of the declared return type, @@ -1384,14 +1384,13 @@ static bool CheckMethodOverrideReturn(Sema &S, } S.Diag(MethodImpl->getLocation(), DiagID) - << MethodImpl->getDeclName() - << MethodDecl->getResultType() - << MethodImpl->getResultType() - << getTypeRange(MethodImpl->getResultTypeSourceInfo()); - S.Diag(MethodDecl->getLocation(), - IsOverridingMode ? diag::note_previous_declaration - : diag::note_previous_definition) - << getTypeRange(MethodDecl->getResultTypeSourceInfo()); + << MethodImpl->getDeclName() << MethodDecl->getReturnType() + << MethodImpl->getReturnType() + << getTypeRange(MethodImpl->getReturnTypeSourceInfo()); + S.Diag(MethodDecl->getLocation(), IsOverridingMode + ? diag::note_previous_declaration + : diag::note_previous_definition) + << getTypeRange(MethodDecl->getReturnTypeSourceInfo()); return false; } @@ -1523,7 +1522,7 @@ static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, // The only reason these methods don't fall within their families is // due to unusual result types. - if (unmatched->getResultType()->isObjCObjectPointerType()) { + if (unmatched->getReturnType()->isObjCObjectPointerType()) { reasonSelector = R_UnrelatedReturn; } else { reasonSelector = R_NonObjectReturn; @@ -2148,8 +2147,8 @@ static bool tryMatchRecordTypes(ASTContext &Context, bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left, const ObjCMethodDecl *right, MethodMatchStrategy strategy) { - if (!matchTypes(Context, strategy, - left->getResultType(), right->getResultType())) + if (!matchTypes(Context, strategy, left->getReturnType(), + right->getReturnType())) return false; // If either is hidden, it is not considered to match. @@ -2278,7 +2277,7 @@ static bool isAcceptableMethodMismatch(ObjCMethodDecl *chosen, // Don't complain about mismatches for -length if the method we // chose has an integral result type. - return (chosen->getResultType()->isIntegerType()); + return (chosen->getReturnType()->isIntegerType()); } ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, @@ -2738,8 +2737,8 @@ CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) { static Sema::ResultTypeCompatibilityKind CheckRelatedResultTypeCompatibility(Sema &S, ObjCMethodDecl *Method, ObjCInterfaceDecl *CurrentClass) { - QualType ResultType = Method->getResultType(); - + QualType ResultType = Method->getReturnType(); + // If an Objective-C method inherits its related result type, then its // declared result type must be compatible with its own class type. The // declared result type is compatible if: @@ -3047,9 +3046,9 @@ Decl *Sema::ActOnMethodDeclaration( QualType resultDeclType; bool HasRelatedResultType = false; - TypeSourceInfo *ResultTInfo = 0; + TypeSourceInfo *ReturnTInfo = 0; if (ReturnType) { - resultDeclType = GetTypeFromParser(ReturnType, &ResultTInfo); + resultDeclType = GetTypeFromParser(ReturnType, &ReturnTInfo); if (CheckFunctionReturnType(resultDeclType, MethodLoc)) return 0; @@ -3061,18 +3060,14 @@ Decl *Sema::ActOnMethodDeclaration( << FixItHint::CreateInsertion(SelectorLocs.front(), "(id)"); } - ObjCMethodDecl* ObjCMethod = - ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, - resultDeclType, - ResultTInfo, - CurContext, - MethodType == tok::minus, isVariadic, - /*isPropertyAccessor=*/false, - /*isImplicitlyDeclared=*/false, /*isDefined=*/false, - MethodDeclKind == tok::objc_optional - ? ObjCMethodDecl::Optional - : ObjCMethodDecl::Required, - HasRelatedResultType); + ObjCMethodDecl *ObjCMethod = ObjCMethodDecl::Create( + Context, MethodLoc, EndLoc, Sel, resultDeclType, ReturnTInfo, CurContext, + MethodType == tok::minus, isVariadic, + /*isPropertyAccessor=*/false, + /*isImplicitlyDeclared=*/false, /*isDefined=*/false, + MethodDeclKind == tok::objc_optional ? ObjCMethodDecl::Optional + : ObjCMethodDecl::Required, + HasRelatedResultType); SmallVector<ParmVarDecl*, 16> Params; diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index caa796d1f0a..c1b7e988c59 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -203,7 +203,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { Old->isExternC()) { FunctionProtoType::ExtProtoInfo EPI = NewProto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_DynamicNone; - QualType NewType = Context.getFunctionType(NewProto->getResultType(), + QualType NewType = Context.getFunctionType(NewProto->getReturnType(), NewProto->getParamTypes(), EPI); New->setType(NewType); return false; @@ -224,7 +224,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // Update the type of the function with the appropriate exception // specification. - QualType NewType = Context.getFunctionType(NewProto->getResultType(), + QualType NewType = Context.getFunctionType(NewProto->getReturnType(), NewProto->getParamTypes(), EPI); New->setType(NewType); @@ -711,11 +711,10 @@ bool Sema::CheckParamExceptionSpec(const PartialDiagnostic & NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc) { - if (CheckSpecForTypesEquivalent(*this, - PDiag(diag::err_deep_exception_specs_differ) << 0, - PDiag(), - Target->getResultType(), TargetLoc, - Source->getResultType(), SourceLoc)) + if (CheckSpecForTypesEquivalent( + *this, PDiag(diag::err_deep_exception_specs_differ) << 0, PDiag(), + Target->getReturnType(), TargetLoc, Source->getReturnType(), + SourceLoc)) return true; // We shouldn't even be testing this unless the arguments are otherwise diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index ff54b6b24e4..e4e0052424d 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -59,8 +59,8 @@ bool Sema::CanUseDecl(NamedDecl *D) { // If the function has a deduced return type, and we can't deduce it, // then we can't use it either. - if (getLangOpts().CPlusPlus1y && FD->getResultType()->isUndeducedType() && - DeduceReturnType(FD, SourceLocation(), /*Diagnose*/false)) + if (getLangOpts().CPlusPlus1y && FD->getReturnType()->isUndeducedType() && + DeduceReturnType(FD, SourceLocation(), /*Diagnose*/ false)) return false; } @@ -295,7 +295,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, // If the function has a deduced return type, and we can't deduce it, // then we can't use it either. - if (getLangOpts().CPlusPlus1y && FD->getResultType()->isUndeducedType() && + if (getLangOpts().CPlusPlus1y && FD->getReturnType()->isUndeducedType() && DeduceReturnType(FD, Loc)) return true; } @@ -2737,7 +2737,7 @@ ExprResult Sema::BuildDeclarationNameExpr( // If we're referring to a function with an __unknown_anytype // result type, make the entire expression __unknown_anytype. - if (fty->getResultType() == Context.UnknownAnyTy) { + if (fty->getReturnType() == Context.UnknownAnyTy) { type = Context.UnknownAnyTy; valueKind = VK_RValue; break; @@ -2756,7 +2756,7 @@ ExprResult Sema::BuildDeclarationNameExpr( // type. if (!cast<FunctionDecl>(VD)->hasPrototype() && isa<FunctionProtoType>(fty)) - type = Context.getFunctionNoProtoType(fty->getResultType(), + type = Context.getFunctionNoProtoType(fty->getReturnType(), fty->getExtInfo()); // Functions are r-values in C. @@ -2774,7 +2774,7 @@ ExprResult Sema::BuildDeclarationNameExpr( // This should only be possible with a type written directly. if (const FunctionProtoType *proto = dyn_cast<FunctionProtoType>(VD->getType())) - if (proto->getResultType() == Context.UnknownAnyTy) { + if (proto->getReturnType() == Context.UnknownAnyTy) { type = Context.UnknownAnyTy; valueKind = VK_RValue; break; @@ -4220,8 +4220,8 @@ bool Sema::GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, if (CallType != VariadicDoesNotApply) { // Assume that extern "C" functions with variadic arguments that // return __unknown_anytype aren't *really* variadic. - if (Proto->getResultType() == Context.UnknownAnyTy && - FDecl && FDecl->isExternC()) { + if (Proto->getReturnType() == Context.UnknownAnyTy && FDecl && + FDecl->isExternC()) { for (unsigned i = ArgIx, e = Args.size(); i != e; ++i) { QualType paramType; // ignored ExprResult arg = checkUnknownAnyArg(CallLoc, Args[i], paramType); @@ -4624,7 +4624,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, << FDecl->getName() << Fn->getSourceRange()); // CUDA: Kernel function must have 'void' return type - if (!FuncT->getResultType()->isVoidType()) + if (!FuncT->getReturnType()->isVoidType()) return ExprError(Diag(LParenLoc, diag::err_kern_type_not_void_return) << Fn->getType() << Fn->getSourceRange()); } else { @@ -4636,14 +4636,13 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, } // Check for a valid return type - if (CheckCallReturnType(FuncT->getResultType(), - Fn->getLocStart(), TheCall, + if (CheckCallReturnType(FuncT->getReturnType(), Fn->getLocStart(), TheCall, FDecl)) return ExprError(); // We know the result type of the call, set it. TheCall->setType(FuncT->getCallResultType(Context)); - TheCall->setValueKind(Expr::getValueKindForType(FuncT->getResultType())); + TheCall->setValueKind(Expr::getValueKindForType(FuncT->getReturnType())); const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(FuncT); if (Proto) { @@ -7547,8 +7546,8 @@ static bool hasIsEqualMethod(Sema &S, const Expr *LHS, const Expr *RHS) { QualType T = Method->param_begin()[0]->getType(); if (!T->isObjCObjectPointerType()) return false; - - QualType R = Method->getResultType(); + + QualType R = Method->getReturnType(); if (!R->isScalarType()) return false; @@ -10322,7 +10321,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, CurBlock->FunctionType = T; const FunctionType *Fn = T->getAs<FunctionType>(); - QualType RetTy = Fn->getResultType(); + QualType RetTy = Fn->getReturnType(); bool isVariadic = (isa<FunctionProtoType>(Fn) && cast<FunctionProtoType>(Fn)->isVariadic()); @@ -10459,7 +10458,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, // Otherwise, if we don't need to change anything about the function type, // preserve its sugar structure. - } else if (FTy->getResultType() == RetTy && + } else if (FTy->getReturnType() == RetTy && (!NoReturn || FTy->getNoReturnAttr())) { BlockTy = BSI->FunctionType; @@ -12953,8 +12952,8 @@ ExprResult RebuildUnknownAnyExpr::VisitObjCMessageExpr(ObjCMessageExpr *E) { // Rewrite the method result type if available. if (ObjCMethodDecl *Method = E->getMethodDecl()) { - assert(Method->getResultType() == S.Context.UnknownAnyTy); - Method->setResultType(DestType); + assert(Method->getReturnType() == S.Context.UnknownAnyTy); + Method->setReturnType(DestType); } // Change the type of the message. diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index eb668ccbfe3..e71b5ba3ca0 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -5675,7 +5675,7 @@ ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl, ME->setHadMultipleCandidates(true); MarkMemberReferenced(ME); - QualType ResultType = Method->getResultType(); + QualType ResultType = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultType); ResultType = ResultType.getNonLValueExprType(Context); diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 87cff1273a4..54aa6a610e0 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -152,7 +152,7 @@ static bool validateBoxingMethod(Sema &S, SourceLocation Loc, } // Make sure the return type is reasonable. - QualType ReturnType = Method->getResultType(); + QualType ReturnType = Method->getReturnType(); if (!ReturnType->isObjCObjectPointerType()) { S.Diag(Loc, diag::err_objc_literal_method_sig) << Sel; @@ -224,16 +224,15 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc, ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel); if (!Method && S.getLangOpts().DebuggerObjCLiteral) { // create a stub definition this NSNumber factory method. - TypeSourceInfo *ResultTInfo = 0; - Method = ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel, - S.NSNumberPointer, ResultTInfo, - S.NSNumberDecl, - /*isInstance=*/false, /*isVariadic=*/false, - /*isPropertyAccessor=*/false, - /*isImplicitlyDeclared=*/true, - /*isDefined=*/false, - ObjCMethodDecl::Required, - /*HasRelatedResultType=*/false); + TypeSourceInfo *ReturnTInfo = 0; + Method = + ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel, + S.NSNumberPointer, ReturnTInfo, S.NSNumberDecl, + /*isInstance=*/false, /*isVariadic=*/false, + /*isPropertyAccessor=*/false, + /*isImplicitlyDeclared=*/true, + /*isDefined=*/false, ObjCMethodDecl::Required, + /*HasRelatedResultType=*/false); ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method, SourceLocation(), SourceLocation(), &CX.Idents.get("value"), @@ -492,17 +491,15 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) { BoxingMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String); if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) { // Debugger needs to work even if NSString hasn't been defined. - TypeSourceInfo *ResultTInfo = 0; - ObjCMethodDecl *M = - ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(), - stringWithUTF8String, NSStringPointer, - ResultTInfo, NSStringDecl, - /*isInstance=*/false, /*isVariadic=*/false, - /*isPropertyAccessor=*/false, - /*isImplicitlyDeclared=*/true, - /*isDefined=*/false, - ObjCMethodDecl::Required, - /*HasRelatedResultType=*/false); + TypeSourceInfo *ReturnTInfo = 0; + ObjCMethodDecl *M = ObjCMethodDecl::Create( + Context, SourceLocation(), SourceLocation(), stringWithUTF8String, + NSStringPointer, ReturnTInfo, NSStringDecl, + /*isInstance=*/false, /*isVariadic=*/false, + /*isPropertyAccessor=*/false, + /*isImplicitlyDeclared=*/true, + /*isDefined=*/false, ObjCMethodDecl::Required, + /*HasRelatedResultType=*/false); QualType ConstCharType = Context.CharTy.withConst(); ParmVarDecl *value = ParmVarDecl::Create(Context, M, @@ -660,17 +657,14 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount); ObjCMethodDecl *Method = NSArrayDecl->lookupClassMethod(Sel); if (!Method && getLangOpts().DebuggerObjCLiteral) { - TypeSourceInfo *ResultTInfo = 0; - Method = ObjCMethodDecl::Create(Context, - SourceLocation(), SourceLocation(), Sel, - IdT, - ResultTInfo, - Context.getTranslationUnitDecl(), - false /*Instance*/, false/*isVariadic*/, - /*isPropertyAccessor=*/false, - /*isImplicitlyDeclared=*/true, /*isDefined=*/false, - ObjCMethodDecl::Required, - false); + TypeSourceInfo *ReturnTInfo = 0; + Method = ObjCMethodDecl::Create( + Context, SourceLocation(), SourceLocation(), Sel, IdT, ReturnTInfo, + Context.getTranslationUnitDecl(), false /*Instance*/, + false /*isVariadic*/, + /*isPropertyAccessor=*/false, + /*isImplicitlyDeclared=*/true, /*isDefined=*/false, + ObjCMethodDecl::Required, false); SmallVector<ParmVarDecl *, 2> Params; ParmVarDecl *objects = ParmVarDecl::Create(Context, Method, SourceLocation(), @@ -1120,7 +1114,8 @@ QualType Sema::getMessageSendResultType(QualType ReceiverType, static const ObjCMethodDecl * findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD, QualType instancetype) { - if (MD->getResultType() == instancetype) return MD; + if (MD->getReturnType() == instancetype) + return MD; // For these purposes, a method in an @implementation overrides a // declaration in the @interface. @@ -1155,7 +1150,7 @@ void Sema::EmitRelatedResultTypeNoteForReturn(QualType destType) { // type doesn't match the method's declared return type. ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(CurContext); if (!MD || !MD->hasRelatedResultType() || - Context.hasSameUnqualifiedType(destType, MD->getResultType())) + Context.hasSameUnqualifiedType(destType, MD->getReturnType())) return; // Look for a method overridden by this method which explicitly uses @@ -1164,7 +1159,7 @@ void Sema::EmitRelatedResultTypeNoteForReturn(QualType destType) { findExplicitInstancetypeDeclarer(MD, Context.getObjCInstanceType())) { SourceLocation loc; SourceRange range; - if (TypeSourceInfo *TSI = overridden->getResultTypeSourceInfo()) { + if (TypeSourceInfo *TSI = overridden->getReturnTypeSourceInfo()) { range = TSI->getTypeLoc().getSourceRange(); loc = range.getBegin(); } @@ -1195,13 +1190,12 @@ void Sema::EmitRelatedResultTypeNote(const Expr *E) { if (!Method->hasRelatedResultType()) return; - - if (Context.hasSameUnqualifiedType(Method->getResultType() - .getNonReferenceType(), - MsgSend->getType())) + + if (Context.hasSameUnqualifiedType( + Method->getReturnType().getNonReferenceType(), MsgSend->getType())) return; - - if (!Context.hasSameUnqualifiedType(Method->getResultType(), + + if (!Context.hasSameUnqualifiedType(Method->getReturnType(), Context.getObjCInstanceType())) return; @@ -1287,7 +1281,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType, ReturnType = getMessageSendResultType(ReceiverType, Method, isClassMessage, isSuperMessage); - VK = Expr::getValueKindForType(Method->getResultType()); + VK = Expr::getValueKindForType(Method->getReturnType()); unsigned NumNamedArgs = Sel.getNumArgs(); // Method might have more arguments than selector indicates. This is due @@ -1456,7 +1450,7 @@ static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) { if (PRE->isImplicitProperty()) { GDecl = PRE->getImplicitPropertyGetter(); if (GDecl) { - T = GDecl->getResultType(); + T = GDecl->getReturnType(); } } else { @@ -2115,8 +2109,8 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, ReturnType, VK)) return ExprError(); - if (Method && !Method->getResultType()->isVoidType() && - RequireCompleteType(LBracLoc, Method->getResultType(), + if (Method && !Method->getReturnType()->isVoidType() && + RequireCompleteType(LBracLoc, Method->getReturnType(), diag::err_illegal_message_expr_incomplete_type)) return ExprError(); @@ -2506,9 +2500,9 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, ClassMessage, SuperLoc.isValid(), LBracLoc, RBracLoc, ReturnType, VK)) return ExprError(); - - if (Method && !Method->getResultType()->isVoidType() && - RequireCompleteType(LBracLoc, Method->getResultType(), + + if (Method && !Method->getReturnType()->isVoidType() && + RequireCompleteType(LBracLoc, Method->getReturnType(), diag::err_illegal_message_expr_incomplete_type)) return ExprError(); @@ -2906,7 +2900,7 @@ namespace { ACCResult checkCallToFunction(FunctionDecl *fn) { // Require a CF*Ref return type. - if (!isCFType(fn->getResultType())) + if (!isCFType(fn->getReturnType())) return ACC_invalid; if (!isAnyRetainable(TargetClass)) @@ -2959,7 +2953,7 @@ namespace { // Check for message sends to functions returning CF types. We // just obey the Cocoa conventions with these, even though the // return type is CF. - if (!isAnyRetainable(TargetClass) || !isCFType(method->getResultType())) + if (!isAnyRetainable(TargetClass) || !isCFType(method->getReturnType())) return ACC_invalid; // If the method is explicitly marked not-retained, it's +0. diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index ecf97d75bf5..75f60ba480f 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -3550,7 +3550,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S, // Compute the returned type of the conversion. if (isa<CXXConversionDecl>(Function)) - T2 = Function->getResultType(); + T2 = Function->getReturnType(); else T2 = cv1T1; @@ -5888,7 +5888,7 @@ InitializationSequence::Perform(Sema &S, CastKind = CK_UserDefinedConversion; - CreatedObject = Conversion->getResultType()->isRecordType(); + CreatedObject = Conversion->getReturnType()->isRecordType(); } bool RequiresCopy = !IsCopy && !isReferenceBinding(Steps.back()); diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 2023c1f61e3..ac3f2efb5b8 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -364,7 +364,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class, // dependent type. if (Class->isDependentContext() || TemplateParams) { const FunctionProtoType *FPT = MethodType->castAs<FunctionProtoType>(); - QualType Result = FPT->getResultType(); + QualType Result = FPT->getReturnType(); if (Result->isUndeducedType()) { Result = SubstAutoType(Result, Context.DependentTy); MethodType = Context.getFunctionType(Result, FPT->getParamTypes(), @@ -456,8 +456,8 @@ void Sema::buildLambdaScope(LambdaScopeInfo *LSI, LSI->Mutable = Mutable; if (ExplicitResultType) { - LSI->ReturnType = CallOperator->getResultType(); - + LSI->ReturnType = CallOperator->getReturnType(); + if (!LSI->ReturnType->isDependentType() && !LSI->ReturnType->isVoidType()) { if (RequireCompleteType(CallOperator->getLocStart(), LSI->ReturnType, @@ -1165,7 +1165,7 @@ static void addFunctionPointerConversion(Sema &S, assert(InvokerExtInfo.RefQualifier == RQ_None && "Lambda's call operator should not have a reference qualifier"); InvokerFunctionTy = - S.Context.getFunctionType(CallOpProto->getResultType(), + S.Context.getFunctionType(CallOpProto->getReturnType(), CallOpProto->getParamTypes(), InvokerExtInfo); PtrToFunctionTy = S.Context.getPointerType(InvokerFunctionTy); } @@ -1332,7 +1332,7 @@ static void addBlockPointerConversion(Sema &S, FunctionProtoType::ExtProtoInfo ExtInfo = Proto->getExtProtoInfo(); ExtInfo.TypeQuals = 0; QualType FunctionTy = S.Context.getFunctionType( - Proto->getResultType(), Proto->getParamTypes(), ExtInfo); + Proto->getReturnType(), Proto->getParamTypes(), ExtInfo); BlockPtrTy = S.Context.getBlockPointerType(FunctionTy); } diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 01220769e32..76ea8f3bae0 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -2194,7 +2194,7 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) { } case Type::FunctionNoProto: { const FunctionType *FnType = cast<FunctionType>(T); - T = FnType->getResultType().getTypePtr(); + T = FnType->getReturnType().getTypePtr(); continue; } diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 659b732c810..beb58ecdfa3 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -1157,13 +1157,11 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc, Ivar->getLocation(), LoadSelfExpr, true, true); - ExprResult Res = - PerformCopyInitialization(InitializedEntity::InitializeResult( - PropertyDiagLoc, - getterMethod->getResultType(), - /*NRVO=*/false), - PropertyDiagLoc, - Owned(IvarRefExpr)); + ExprResult Res = PerformCopyInitialization( + InitializedEntity::InitializeResult(PropertyDiagLoc, + getterMethod->getReturnType(), + /*NRVO=*/false), + PropertyDiagLoc, Owned(IvarRefExpr)); if (!Res.isInvalid()) { Expr *ResExpr = Res.takeAs<Expr>(); if (ResExpr) @@ -1385,7 +1383,7 @@ bool Sema::DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *property, SourceLocation Loc) { if (!GetterMethod) return false; - QualType GetterType = GetterMethod->getResultType().getNonReferenceType(); + QualType GetterType = GetterMethod->getReturnType().getNonReferenceType(); QualType PropertyIvarType = property->getType().getNonReferenceType(); bool compat = Context.hasSameType(PropertyIvarType, GetterType); if (!compat) { @@ -1883,8 +1881,8 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCPropertyDecl::PropertyAttributeKind CAttr = property->getPropertyAttributes(); if ((!(CAttr & ObjCPropertyDecl::OBJC_PR_readonly)) && - Context.getCanonicalType(SetterMethod->getResultType()) != - Context.VoidTy) + Context.getCanonicalType(SetterMethod->getReturnType()) != + Context.VoidTy) Diag(SetterMethod->getLocation(), diag::err_setter_type_void); if (SetterMethod->param_size() != 1 || !Context.hasSameUnqualifiedType( diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 2a3ab80ba4f..8e52e620a77 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -1027,7 +1027,7 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old, (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(), OldTemplate->getTemplateParameters(), false, TPL_TemplateMatch) || - OldType->getResultType() != NewType->getResultType())) + OldType->getReturnType() != NewType->getReturnType())) return true; // If the function is a class member, its signature includes the @@ -2303,11 +2303,11 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, return false; bool HasObjCConversion = false; - if (Context.getCanonicalType(FromFunctionType->getResultType()) - == Context.getCanonicalType(ToFunctionType->getResultType())) { + if (Context.getCanonicalType(FromFunctionType->getReturnType()) == + Context.getCanonicalType(ToFunctionType->getReturnType())) { // Okay, the types match exactly. Nothing to do. - } else if (isObjCPointerConversion(FromFunctionType->getResultType(), - ToFunctionType->getResultType(), + } else if (isObjCPointerConversion(FromFunctionType->getReturnType(), + ToFunctionType->getReturnType(), ConvertedType, IncompatibleObjC)) { // Okay, we have an Objective-C pointer conversion. HasObjCConversion = true; @@ -2455,12 +2455,12 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, return false; bool IncompatibleObjC = false; - if (Context.hasSameType(FromFunctionType->getResultType(), - ToFunctionType->getResultType())) { + if (Context.hasSameType(FromFunctionType->getReturnType(), + ToFunctionType->getReturnType())) { // Okay, the types match exactly. Nothing to do. } else { - QualType RHS = FromFunctionType->getResultType(); - QualType LHS = ToFunctionType->getResultType(); + QualType RHS = FromFunctionType->getReturnType(); + QualType LHS = ToFunctionType->getReturnType(); if ((!getLangOpts().CPlusPlus || !RHS->isRecordType()) && !RHS.hasQualifiers() && LHS.hasQualifiers()) LHS = LHS.getUnqualifiedType(); @@ -2583,10 +2583,10 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, } // Handle different return type. - if (!Context.hasSameType(FromFunction->getResultType(), - ToFunction->getResultType())) { - PDiag << ft_return_type << ToFunction->getResultType() - << FromFunction->getResultType(); + if (!Context.hasSameType(FromFunction->getReturnType(), + ToFunction->getReturnType())) { + PDiag << ft_return_type << ToFunction->getReturnType() + << FromFunction->getReturnType(); return; } @@ -4439,9 +4439,9 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, } else if (ICS.isUserDefined()) { // Don't allow rvalue references to bind to lvalues. if (DeclType->isRValueReferenceType()) { - if (const ReferenceType *RefType - = ICS.UserDefined.ConversionFunction->getResultType() - ->getAs<LValueReferenceType>()) { + if (const ReferenceType *RefType = + ICS.UserDefined.ConversionFunction->getReturnType() + ->getAs<LValueReferenceType>()) { if (!RefType->getPointeeType()->isFunctionType()) { ICS.setBad(BadConversionSequence::lvalue_ref_to_rvalue, Init, DeclType); @@ -9718,7 +9718,7 @@ private: // If any candidate has a placeholder return type, trigger its deduction // now. if (S.getLangOpts().CPlusPlus1y && - FunDecl->getResultType()->isUndeducedType() && + FunDecl->getReturnType()->isUndeducedType() && S.DeduceReturnType(FunDecl, SourceExpr->getLocStart(), Complain)) return false; @@ -10023,7 +10023,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, } if (Matched && getLangOpts().CPlusPlus1y && - Matched->getResultType()->isUndeducedType() && + Matched->getReturnType()->isUndeducedType() && DeduceReturnType(Matched, ovl->getExprLoc(), Complain)) return 0; @@ -10717,7 +10717,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, return ExprError(); // Determine the result type. - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -10726,8 +10726,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn, new (Context) CXXOperatorCallExpr(Context, Op, FnExpr.take(), ArgsArray, ResultTy, VK, OpLoc, false); - if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall, - FnDecl)) + if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -10952,7 +10951,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, return ExprError(); // Determine the result type. - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -10961,7 +10960,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc, Args, ResultTy, VK, OpLoc, FPFeatures.fp_contract); - if (CheckCallReturnType(FnDecl->getResultType(), OpLoc, TheCall, + if (CheckCallReturnType(FnDecl->getReturnType(), OpLoc, TheCall, FnDecl)) return ExprError(); @@ -11168,7 +11167,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, return ExprError(); // Determine the result type - QualType ResultTy = FnDecl->getResultType(); + QualType ResultTy = FnDecl->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11178,8 +11177,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, ResultTy, VK, RLoc, false); - if (CheckCallReturnType(FnDecl->getResultType(), LLoc, TheCall, - FnDecl)) + if (CheckCallReturnType(FnDecl->getReturnType(), LLoc, TheCall, FnDecl)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -11271,7 +11269,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, const FunctionProtoType *proto = fnType->castAs<FunctionProtoType>(); QualType resultType = proto->getCallResultType(Context); - ExprValueKind valueKind = Expr::getValueKindForType(proto->getResultType()); + ExprValueKind valueKind = Expr::getValueKindForType(proto->getReturnType()); // Check that the object type isn't more qualified than the // member function we're calling. @@ -11297,8 +11295,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, = new (Context) CXXMemberCallExpr(Context, MemExprE, Args, resultType, valueKind, RParenLoc); - if (CheckCallReturnType(proto->getResultType(), - op->getRHS()->getLocStart(), + if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(), call, 0)) return ExprError(); @@ -11437,7 +11434,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, MemExpr = cast<MemberExpr>(MemExprE->IgnoreParens()); } - QualType ResultType = Method->getResultType(); + QualType ResultType = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultType); ResultType = ResultType.getNonLValueExprType(Context); @@ -11447,7 +11444,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, ResultType, VK, RParenLoc); // Check for a valid return type. - if (CheckCallReturnType(Method->getResultType(), MemExpr->getMemberLoc(), + if (CheckCallReturnType(Method->getReturnType(), MemExpr->getMemberLoc(), TheCall, Method)) return ExprError(); @@ -11696,7 +11693,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, // Once we've built TheCall, all of the expressions are properly // owned. - QualType ResultTy = Method->getResultType(); + QualType ResultTy = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11706,8 +11703,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj, ResultTy, VK, RParenLoc, false); MethodArgs.reset(); - if (CheckCallReturnType(Method->getResultType(), LParenLoc, TheCall, - Method)) + if (CheckCallReturnType(Method->getReturnType(), LParenLoc, TheCall, Method)) return true; // We may have default arguments. If so, we need to allocate more @@ -11879,15 +11875,14 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, if (FnExpr.isInvalid()) return ExprError(); - QualType ResultTy = Method->getResultType(); + QualType ResultTy = Method->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); CXXOperatorCallExpr *TheCall = new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr.take(), Base, ResultTy, VK, OpLoc, false); - if (CheckCallReturnType(Method->getResultType(), OpLoc, TheCall, - Method)) + if (CheckCallReturnType(Method->getReturnType(), OpLoc, TheCall, Method)) return ExprError(); return MaybeBindToTemporary(TheCall); @@ -11948,7 +11943,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R, ConvArgs[ArgIdx] = InputInit.take(); } - QualType ResultTy = FD->getResultType(); + QualType ResultTy = FD->getReturnType(); ExprValueKind VK = Expr::getValueKindForType(ResultTy); ResultTy = ResultTy.getNonLValueExprType(Context); @@ -11957,7 +11952,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R, llvm::makeArrayRef(ConvArgs, Args.size()), ResultTy, VK, LitEndLoc, UDSuffixLoc); - if (CheckCallReturnType(FD->getResultType(), UDSuffixLoc, UDL, FD)) + if (CheckCallReturnType(FD->getReturnType(), UDSuffixLoc, UDL, FD)) return ExprError(); if (CheckFunctionCall(FD, UDL, NULL)) diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp index 1301ae32f1a..81657e366e5 100644 --- a/lib/Sema/SemaPseudoObject.cpp +++ b/lib/Sema/SemaPseudoObject.cpp @@ -540,7 +540,7 @@ bool ObjCPropertyOpBuilder::isWeakProperty() const { T = Prop->getType(); } else if (Getter) { - T = Getter->getResultType(); + T = Getter->getReturnType(); } else { return false; } @@ -813,7 +813,7 @@ bool ObjCPropertyOpBuilder::tryBuildGetOfReference(Expr *op, assert(Getter && "property has no setter and no getter!"); // Only do this if the getter returns an l-value reference type. - QualType resultType = Getter->getResultType(); + QualType resultType = Getter->getReturnType(); if (!resultType->isLValueReferenceType()) return false; result = buildRValueOperation(op); @@ -1170,7 +1170,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { diag::note_parameter_type) << T; return false; } - QualType R = AtIndexGetter->getResultType(); + QualType R = AtIndexGetter->getReturnType(); if (!R->isObjCObjectPointerType()) { S.Diag(RefExpr->getKeyExpr()->getExprLoc(), diag::err_objc_indexing_method_result_type) << R << arrayRef; @@ -1237,18 +1237,15 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { BaseT->isObjCQualifiedIdType()); if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) { - TypeSourceInfo *ResultTInfo = 0; + TypeSourceInfo *ReturnTInfo = 0; QualType ReturnType = S.Context.VoidTy; - AtIndexSetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), - SourceLocation(), AtIndexSetterSelector, - ReturnType, - ResultTInfo, - S.Context.getTranslationUnitDecl(), - true /*Instance*/, false/*isVariadic*/, - /*isPropertyAccessor=*/false, - /*isImplicitlyDeclared=*/true, /*isDefined=*/false, - ObjCMethodDecl::Required, - false); + AtIndexSetter = ObjCMethodDecl::Create( + S.Context, SourceLocation(), SourceLocation(), AtIndexSetterSelector, + ReturnType, ReturnTInfo, S.Context.getTranslationUnitDecl(), + true /*Instance*/, false /*isVariadic*/, + /*isPropertyAccessor=*/false, + /*isImplicitlyDeclared=*/true, /*isDefined=*/false, + ObjCMethodDecl::Required, false); SmallVector<ParmVarDecl *, 2> Params; ParmVarDecl *object = ParmVarDecl::Create(S.Context, AtIndexSetter, SourceLocation(), SourceLocation(), diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index e9ae7b90f00..554535dcf22 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -2560,7 +2560,7 @@ Sema::PerformMoveOrCopyInitialization(const InitializedEntity &Entity, static bool hasDeducedReturnType(FunctionDecl *FD) { const FunctionProtoType *FPT = FD->getTypeSourceInfo()->getType()->castAs<FunctionProtoType>(); - return FPT->getResultType()->isUndeducedType(); + return FPT->getReturnType()->isUndeducedType(); } /// ActOnCapScopeReturnStmt - Utility routine to type-check return statements @@ -2579,7 +2579,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // FIXME: Blocks might have a return type of 'auto' explicitly specified. FunctionDecl *FD = CurLambda->CallOperator; if (CurCap->ReturnType.isNull()) - CurCap->ReturnType = FD->getResultType(); + CurCap->ReturnType = FD->getReturnType(); AutoType *AT = CurCap->ReturnType->getContainedAutoType(); assert(AT && "lost auto type from lambda return type"); @@ -2587,7 +2587,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { FD->setInvalidDecl(); return StmtError(); } - CurCap->ReturnType = FnRetType = FD->getResultType(); + CurCap->ReturnType = FnRetType = FD->getReturnType(); } else if (CurCap->HasImplicitReturnType) { // For blocks/lambdas with implicit return types, we check each return // statement individually, and deduce the common return type when the block @@ -2810,14 +2810,14 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { bool isObjCMethod = false; if (const FunctionDecl *FD = getCurFunctionDecl()) { - FnRetType = FD->getResultType(); + FnRetType = FD->getReturnType(); if (FD->hasAttrs()) Attrs = &FD->getAttrs(); if (FD->isNoReturn()) Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD->getDeclName(); } else if (ObjCMethodDecl *MD = getCurMethodDecl()) { - FnRetType = MD->getResultType(); + FnRetType = MD->getReturnType(); isObjCMethod = true; if (MD->hasAttrs()) Attrs = &MD->getAttrs(); @@ -2840,7 +2840,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { FD->setInvalidDecl(); return StmtError(); } else { - FnRetType = FD->getResultType(); + FnRetType = FD->getReturnType(); } } } diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index dcfdd319990..008ed2755c2 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -3899,12 +3899,12 @@ bool UnnamedLocalNoLinkageFinder::VisitFunctionProtoType( return true; } - return Visit(T->getResultType()); + return Visit(T->getReturnType()); } bool UnnamedLocalNoLinkageFinder::VisitFunctionNoProtoType( const FunctionNoProtoType* T) { - return Visit(T->getResultType()); + return Visit(T->getReturnType()); } bool UnnamedLocalNoLinkageFinder::VisitUnresolvedUsingType( @@ -6514,7 +6514,7 @@ bool Sema::CheckFunctionTemplateSpecialization( const FunctionProtoType *FPT = FT->castAs<FunctionProtoType>(); FunctionProtoType::ExtProtoInfo EPI = FPT->getExtProtoInfo(); EPI.TypeQuals |= Qualifiers::Const; - FT = Context.getFunctionType(FPT->getResultType(), + FT = Context.getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI); } } diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 256bb7c3951..94ef7f46fd9 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1375,11 +1375,10 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, return Sema::TDK_NonDeducedMismatch; // Check return types. - if (Sema::TemplateDeductionResult Result - = DeduceTemplateArgumentsByTypeMatch(S, TemplateParams, - FunctionProtoParam->getResultType(), - FunctionProtoArg->getResultType(), - Info, Deduced, 0)) + if (Sema::TemplateDeductionResult Result = + DeduceTemplateArgumentsByTypeMatch( + S, TemplateParams, FunctionProtoParam->getReturnType(), + FunctionProtoArg->getReturnType(), Info, Deduced, 0)) return Result; return DeduceTemplateArguments( @@ -2614,11 +2613,11 @@ Sema::SubstituteExplicitTemplateArguments( CXXThisScopeRAII ThisScope(*this, ThisContext, ThisTypeQuals, getLangOpts().CPlusPlus11); - - ResultType = SubstType(Proto->getResultType(), - MultiLevelTemplateArgumentList(*ExplicitArgumentList), - Function->getTypeSpecStartLoc(), - Function->getDeclName()); + + ResultType = + SubstType(Proto->getReturnType(), + MultiLevelTemplateArgumentList(*ExplicitArgumentList), + Function->getTypeSpecStartLoc(), Function->getDeclName()); if (ResultType.isNull() || Trap.hasErrorOccurred()) return TDK_SubstitutionFailure; } @@ -2986,8 +2985,8 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, static QualType GetTypeOfFunction(Sema &S, const OverloadExpr::FindResult &R, FunctionDecl *Fn) { // We may need to deduce the return type of the function now. - if (S.getLangOpts().CPlusPlus1y && Fn->getResultType()->isUndeducedType() && - S.DeduceReturnType(Fn, R.Expression->getExprLoc(), /*Diagnose*/false)) + if (S.getLangOpts().CPlusPlus1y && Fn->getReturnType()->isUndeducedType() && + S.DeduceReturnType(Fn, R.Expression->getExprLoc(), /*Diagnose*/ false)) return QualType(); if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) @@ -3599,7 +3598,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // type so that we treat it as a non-deduced context in what follows. bool HasDeducedReturnType = false; if (getLangOpts().CPlusPlus1y && InOverloadResolution && - Function->getResultType()->getContainedAutoType()) { + Function->getReturnType()->getContainedAutoType()) { FunctionType = SubstAutoType(FunctionType, Context.DependentTy); HasDeducedReturnType = true; } @@ -3624,7 +3623,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate, // If the function has a deduced return type, deduce it now, so we can check // that the deduced function type matches the requested type. if (HasDeducedReturnType && - Specialization->getResultType()->isUndeducedType() && + Specialization->getReturnType()->isUndeducedType() && DeduceReturnType(Specialization, Info.getLocation(), false)) return TDK_MiscellaneousDeductionFailure; @@ -3653,7 +3652,7 @@ static inline void SubstAutoWithinFunctionReturnType(FunctionDecl *F, QualType TypeToReplaceAutoWith, Sema &S) { assert(!TypeToReplaceAutoWith->getContainedAutoType()); - QualType AutoResultType = F->getResultType(); + QualType AutoResultType = F->getReturnType(); assert(AutoResultType->getContainedAutoType()); QualType DeducedResultType = S.SubstAutoType(AutoResultType, TypeToReplaceAutoWith); @@ -3678,7 +3677,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( assert(LambdaClass && LambdaClass->isGenericLambda()); CXXMethodDecl *CallOpGeneric = LambdaClass->getLambdaCallOperator(); - QualType CallOpResultType = CallOpGeneric->getResultType(); + QualType CallOpResultType = CallOpGeneric->getReturnType(); const bool GenericLambdaCallOperatorHasDeducedReturnType = CallOpResultType->getContainedAutoType(); @@ -3695,15 +3694,15 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( return Result; // If we need to deduce the return type, do so (instantiates the callop). - if (GenericLambdaCallOperatorHasDeducedReturnType && - CallOpSpecialized->getResultType()->isUndeducedType()) + if (GenericLambdaCallOperatorHasDeducedReturnType && + CallOpSpecialized->getReturnType()->isUndeducedType()) S.DeduceReturnType(CallOpSpecialized, CallOpSpecialized->getPointOfInstantiation(), /*Diagnose*/ true); // Check to see if the return type of the destination ptr-to-function // matches the return type of the call operator. - if (!S.Context.hasSameType(CallOpSpecialized->getResultType(), + if (!S.Context.hasSameType(CallOpSpecialized->getReturnType(), ReturnTypeOfDestFunctionPtr)) return Sema::TDK_NonDeducedMismatch; // Since we have succeeded in matching the source and destination @@ -3722,8 +3721,8 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( "If the call operator succeeded so should the invoker!"); // Set the result type to match the corresponding call operator // specialization's result type. - if (GenericLambdaCallOperatorHasDeducedReturnType && - InvokerSpecialized->getResultType()->isUndeducedType()) { + if (GenericLambdaCallOperatorHasDeducedReturnType && + InvokerSpecialized->getReturnType()->isUndeducedType()) { // Be sure to get the type to replace 'auto' with and not // the full result type of the call op specialization // to substitute into the 'auto' of the invoker and conversion @@ -3732,9 +3731,9 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( // int* (*fp)(int*) = [](auto* a) -> auto* { return a; }; // We don't want to subst 'int*' into 'auto' to get int**. - QualType TypeToReplaceAutoWith = - CallOpSpecialized->getResultType()-> - getContainedAutoType()->getDeducedType(); + QualType TypeToReplaceAutoWith = CallOpSpecialized->getReturnType() + ->getContainedAutoType() + ->getDeducedType(); SubstAutoWithinFunctionReturnType(InvokerSpecialized, TypeToReplaceAutoWith, S); SubstAutoWithinFunctionReturnType(ConversionSpecialized, @@ -3750,7 +3749,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker( FunctionProtoType::ExtProtoInfo EPI = InvokerFPT->getExtProtoInfo(); EPI.TypeQuals = 0; InvokerSpecialized->setType(S.Context.getFunctionType( - InvokerFPT->getResultType(), InvokerFPT->getParamTypes(), EPI)); + InvokerFPT->getReturnType(), InvokerFPT->getParamTypes(), EPI)); return Sema::TDK_Success; } /// \brief Deduce template arguments for a templated conversion @@ -3873,8 +3872,8 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *ConversionTemplate, "Can only convert from lambda to ptr-to-function"); const FunctionType *ToFunType = A->getPointeeType().getTypePtr()->getAs<FunctionType>(); - const QualType DestFunctionPtrReturnType = ToFunType->getResultType(); - + const QualType DestFunctionPtrReturnType = ToFunType->getReturnType(); + // Create the corresponding specializations of the call operator and // the static-invoker; and if the return type is auto, // deduce the return type and check if it matches the @@ -4119,12 +4118,12 @@ void Sema::DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init) { bool Sema::DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose) { - assert(FD->getResultType()->isUndeducedType()); + assert(FD->getReturnType()->isUndeducedType()); if (FD->getTemplateInstantiationPattern()) InstantiateFunctionDefinition(Loc, FD); - bool StillUndeduced = FD->getResultType()->isUndeducedType(); + bool StillUndeduced = FD->getReturnType()->isUndeducedType(); if (StillUndeduced && Diagnose && !FD->isInvalidDecl()) { Diag(Loc, diag::err_auto_fn_used_before_defined) << FD; Diag(FD->getLocation(), diag::note_callee_decl) << FD; @@ -4254,12 +4253,10 @@ static bool isAtLeastAsSpecializedAs(Sema &S, case TPOC_Conversion: // - In the context of a call to a conversion operator, the return types // of the conversion function templates are used. - if (DeduceTemplateArgumentsByTypeMatch(S, TemplateParams, - Proto2->getResultType(), - Proto1->getResultType(), - Info, Deduced, TDF_None, - /*PartialOrdering=*/true, - RefParamComparisons)) + if (DeduceTemplateArgumentsByTypeMatch( + S, TemplateParams, Proto2->getReturnType(), Proto1->getReturnType(), + Info, Deduced, TDF_None, + /*PartialOrdering=*/true, RefParamComparisons)) return false; break; @@ -4303,9 +4300,8 @@ static bool isAtLeastAsSpecializedAs(Sema &S, break; case TPOC_Conversion: - ::MarkUsedTemplateParameters(S.Context, Proto2->getResultType(), false, - TemplateParams->getDepth(), - UsedParameters); + ::MarkUsedTemplateParameters(S.Context, Proto2->getReturnType(), false, + TemplateParams->getDepth(), UsedParameters); break; case TPOC_Other: @@ -4880,8 +4876,8 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T, case Type::FunctionProto: { const FunctionProtoType *Proto = cast<FunctionProtoType>(T); - MarkUsedTemplateParameters(Ctx, Proto->getResultType(), OnlyDeduced, - Depth, Used); + MarkUsedTemplateParameters(Ctx, Proto->getReturnType(), OnlyDeduced, Depth, + Used); for (unsigned I = 0, N = Proto->getNumParams(); I != N; ++I) MarkUsedTemplateParameters(Ctx, Proto->getParamType(I), OnlyDeduced, Depth, Used); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 438798433c1..a434e20634d 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1217,7 +1217,7 @@ static QualType adjustFunctionTypeForInstantiation(ASTContext &Context, FunctionProtoType::ExtProtoInfo NewEPI = NewFunc->getExtProtoInfo(); NewEPI.ExtInfo = OrigFunc->getExtInfo(); - return Context.getFunctionType(NewFunc->getResultType(), + return Context.getFunctionType(NewFunc->getReturnType(), NewFunc->getParamTypes(), NewEPI); } @@ -3160,7 +3160,7 @@ static void InstantiateExceptionSpec(Sema &SemaRef, FunctionDecl *New, EPI.Exceptions = Exceptions.data(); EPI.NoexceptExpr = NoexceptExpr; - New->setType(SemaRef.Context.getFunctionType(NewProto->getResultType(), + New->setType(SemaRef.Context.getFunctionType(NewProto->getReturnType(), NewProto->getParamTypes(), EPI)); } @@ -3177,7 +3177,7 @@ void Sema::InstantiateExceptionSpec(SourceLocation PointOfInstantiation, // so that our callers don't have to cope with EST_Uninstantiated. FunctionProtoType::ExtProtoInfo EPI = Proto->getExtProtoInfo(); EPI.ExceptionSpecType = EST_None; - Decl->setType(Context.getFunctionType(Proto->getResultType(), + Decl->setType(Context.getFunctionType(Proto->getReturnType(), Proto->getParamTypes(), EPI)); return; } @@ -3262,7 +3262,7 @@ TemplateDeclInstantiator::InitFunctionInstantiation(FunctionDecl *New, EPI.ExceptionSpecDecl = New; EPI.ExceptionSpecTemplate = ExceptionSpecTemplate; New->setType(SemaRef.Context.getFunctionType( - NewProto->getResultType(), NewProto->getParamTypes(), EPI)); + NewProto->getReturnType(), NewProto->getParamTypes(), EPI)); } else { ::InstantiateExceptionSpec(SemaRef, New, Proto, TemplateArgs); } @@ -3390,10 +3390,10 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, // initializer or return value, and class template specializations, other // explicit instantiation declarations have the effect of suppressing the // implicit instantiation of the entity to which they refer. - if (Function->getTemplateSpecializationKind() - == TSK_ExplicitInstantiationDeclaration && + if (Function->getTemplateSpecializationKind() == + TSK_ExplicitInstantiationDeclaration && !PatternDecl->isInlined() && - !PatternDecl->getResultType()->getContainedAutoType()) + !PatternDecl->getReturnType()->getContainedAutoType()) return; if (PatternDecl->isInlined()) diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 4b3e6023cf5..c2ff2238d5f 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -3114,7 +3114,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, EPI.TypeQuals = 0; EPI.RefQualifier = RQ_None; - T = Context.getFunctionType(FnTy->getResultType(), FnTy->getParamTypes(), + T = Context.getFunctionType(FnTy->getReturnType(), FnTy->getParamTypes(), EPI); // Rebuild any parens around the identifier in the function type. for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 27380f8c8d4..37f6bb79ec2 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2532,11 +2532,9 @@ public: CK_BuiltinFnToFnPtr).take(); // Build the CallExpr - ExprResult TheCall = SemaRef.Owned( - new (SemaRef.Context) CallExpr(SemaRef.Context, Callee, SubExprs, - Builtin->getCallResultType(), - Expr::getValueKindForType(Builtin->getResultType()), - RParenLoc)); + ExprResult TheCall = SemaRef.Owned(new (SemaRef.Context) CallExpr( + SemaRef.Context, Callee, SubExprs, Builtin->getCallResultType(), + Expr::getValueKindForType(Builtin->getReturnType()), RParenLoc)); // Type-check the __builtin_shufflevector expression. return SemaRef.SemaBuiltinShuffleVector(cast<CallExpr>(TheCall.take())); @@ -4389,7 +4387,7 @@ TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB, // FIXME: Need to transform the exception-specification too. QualType Result = TL.getType(); - if (getDerived().AlwaysRebuild() || ResultType != T->getResultType() || + if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType() || T->getNumParams() != ParamTypes.size() || !std::equal(T->param_type_begin(), T->param_type_end(), ParamTypes.begin())) { @@ -4420,8 +4418,7 @@ QualType TreeTransform<Derived>::TransformFunctionNoProtoType( return QualType(); QualType Result = TL.getType(); - if (getDerived().AlwaysRebuild() || - ResultType != T->getResultType()) + if (getDerived().AlwaysRebuild() || ResultType != T->getReturnType()) Result = getDerived().RebuildFunctionNoProtoType(ResultType); FunctionNoProtoTypeLoc NewTL = TLB.push<FunctionNoProtoTypeLoc>(Result); @@ -9261,7 +9258,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) { const FunctionProtoType *exprFunctionType = E->getFunctionType(); QualType exprResultType = - getDerived().TransformType(exprFunctionType->getResultType()); + getDerived().TransformType(exprFunctionType->getReturnType()); QualType functionType = getDerived().RebuildFunctionProtoType(exprResultType, paramTypes, diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index fc61be33fa3..a9ff8a0b731 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -712,8 +712,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { MD->setDeclImplementation((ObjCMethodDecl::ImplementationControl)Record[Idx++]); MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]); MD->SetRelatedResultType(Record[Idx++]); - MD->setResultType(Reader.readType(F, Record, Idx)); - MD->setResultTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); + MD->setReturnType(Reader.readType(F, Record, Idx)); + MD->setReturnTypeSourceInfo(GetTypeSourceInfo(Record, Idx)); MD->DeclEndLoc = ReadSourceLocation(Record, Idx); unsigned NumParams = Record[Idx++]; SmallVector<ParmVarDecl *, 16> Params; diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 5760e38bb40..cb059ecc4e3 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -179,7 +179,7 @@ void ASTTypeWriter::VisitExtVectorType(const ExtVectorType *T) { } void ASTTypeWriter::VisitFunctionType(const FunctionType *T) { - Writer.AddTypeRef(T->getResultType(), Record); + Writer.AddTypeRef(T->getReturnType(), Record); FunctionType::ExtInfo C = T->getExtInfo(); Record.push_back(C.getNoReturn()); Record.push_back(C.getHasRegParm()); diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 5770cd72785..89f9b4885fa 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -451,8 +451,8 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) { // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway Record.push_back(D->getObjCDeclQualifier()); Record.push_back(D->hasRelatedResultType()); - Writer.AddTypeRef(D->getResultType(), Record); - Writer.AddTypeSourceInfo(D->getResultTypeSourceInfo(), Record); + Writer.AddTypeRef(D->getReturnType(), Record); + Writer.AddTypeSourceInfo(D->getReturnTypeSourceInfo(), Record); Writer.AddSourceLocation(D->getLocEnd(), Record); Record.push_back(D->param_size()); for (ObjCMethodDecl::param_iterator P = D->param_begin(), diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp index cf2d6cc349e..d989fdf572d 100644 --- a/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp @@ -42,8 +42,8 @@ static void CompareReturnTypes(const ObjCMethodDecl *MethDerived, BugReporter &BR, ASTContext &Ctx, const ObjCImplementationDecl *ID) { - QualType ResDerived = MethDerived->getResultType(); - QualType ResAncestor = MethAncestor->getResultType(); + QualType ResDerived = MethDerived->getReturnType(); + QualType ResAncestor = MethAncestor->getReturnType(); if (!AreTypesCompatible(ResDerived, ResAncestor, Ctx)) { std::string sbuf; diff --git a/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp index 9f01522eadb..235ad5d534d 100644 --- a/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp @@ -54,7 +54,7 @@ void NSErrorMethodChecker::checkASTDecl(const ObjCMethodDecl *D, BugReporter &BR) const { if (!D->isThisDeclarationADefinition()) return; - if (!D->getResultType()->isVoidType()) + if (!D->getReturnType()->isVoidType()) return; if (!II) @@ -102,7 +102,7 @@ void CFErrorFunctionChecker::checkASTDecl(const FunctionDecl *D, BugReporter &BR) const { if (!D->doesThisDeclarationHaveABody()) return; - if (!D->getResultType()->isVoidType()) + if (!D->getReturnType()->isVoidType()) return; if (!II) diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 24a0519eb26..a25586550db 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -688,7 +688,7 @@ public: const RetainSummary *getMethodSummary(const ObjCMethodDecl *MD) { const ObjCInterfaceDecl *ID = MD->getClassInterface(); Selector S = MD->getSelector(); - QualType ResultTy = MD->getResultType(); + QualType ResultTy = MD->getReturnType(); ObjCMethodSummariesTy *CachedSummaries; if (MD->isInstanceMethod()) @@ -970,7 +970,7 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) { FName = FName.substr(FName.find_first_not_of('_')); // Inspect the result type. - QualType RetTy = FT->getResultType(); + QualType RetTy = FT->getReturnType(); // FIXME: This should all be refactored into a chain of "summary lookup" // filters. @@ -1252,8 +1252,8 @@ RetainSummaryManager::updateSummaryFromAnnotations(const RetainSummary *&Summ, else if (pd->hasAttr<CFConsumedAttr>()) Template->addArg(AF, parm_idx, DecRef); } - - QualType RetTy = FD->getResultType(); + + QualType RetTy = FD->getReturnType(); if (Optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, FD)) Template->setRetEffect(*RetE); } @@ -1283,8 +1283,8 @@ RetainSummaryManager::updateSummaryFromAnnotations(const RetainSummary *&Summ, Template->addArg(AF, parm_idx, DecRef); } } - - QualType RetTy = MD->getResultType(); + + QualType RetTy = MD->getReturnType(); if (Optional<RetEffect> RetE = getRetEffectFromAnnotations(RetTy, MD)) Template->setRetEffect(*RetE); } diff --git a/lib/StaticAnalyzer/Core/CallEvent.cpp b/lib/StaticAnalyzer/Core/CallEvent.cpp index d72678e2e42..121e35fa7d5 100644 --- a/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -239,9 +239,9 @@ bool CallEvent::isCallStmt(const Stmt *S) { QualType CallEvent::getDeclaredResultType(const Decl *D) { assert(D); if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) - return FD->getResultType(); + return FD->getReturnType(); if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(D)) - return MD->getResultType(); + return MD->getReturnType(); if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) { // Blocks are difficult because the return type may not be stored in the // BlockDecl itself. The AST should probably be enhanced, but for now we @@ -254,7 +254,7 @@ QualType CallEvent::getDeclaredResultType(const Decl *D) { if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) { QualType Ty = TSI->getType(); if (const FunctionType *FT = Ty->getAs<FunctionType>()) - Ty = FT->getResultType(); + Ty = FT->getReturnType(); if (!Ty->isDependentType()) return Ty; } diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index f0ef288c5e2..407051de1cc 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -895,7 +895,7 @@ bool CursorVisitor::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) { } bool CursorVisitor::VisitObjCMethodDecl(ObjCMethodDecl *ND) { - if (TypeSourceInfo *TSInfo = ND->getResultTypeSourceInfo()) + if (TypeSourceInfo *TSInfo = ND->getReturnTypeSourceInfo()) if (Visit(TSInfo->getTypeLoc())) return true; diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index 5007047ea6d..d31168c1e75 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -570,8 +570,8 @@ CXType clang_getResultType(CXType X) { return MakeCXType(QualType(), GetTU(X)); if (const FunctionType *FD = T->getAs<FunctionType>()) - return MakeCXType(FD->getResultType(), GetTU(X)); - + return MakeCXType(FD->getReturnType(), GetTU(X)); + return MakeCXType(QualType(), GetTU(X)); } @@ -579,7 +579,7 @@ CXType clang_getCursorResultType(CXCursor C) { if (clang_isDeclaration(C.kind)) { const Decl *D = cxcursor::getCursorDecl(C); if (const ObjCMethodDecl *MD = dyn_cast_or_null<ObjCMethodDecl>(D)) - return MakeCXType(MD->getResultType(), cxcursor::getCursorTU(C)); + return MakeCXType(MD->getReturnType(), cxcursor::getCursorTU(C)); return clang_getResultType(clang_getCursorType(C)); } diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index 89feb96d48e..643aad42098 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -55,7 +55,7 @@ public: if (D->isImplicit()) return; - IndexCtx.indexTypeSourceInfo(D->getResultTypeSourceInfo(), D); + IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D); for (ObjCMethodDecl::param_const_iterator I = D->param_begin(), E = D->param_end(); I != E; ++I) -- GitLab