From 314cc81b8caacd6f9b3f74c4e32ac9403d8d4052 Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Sat, 25 Jan 2014 16:55:45 +0000 Subject: 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. llvm-svn: 200082 --- clang/lib/Rewrite/Frontend/RewriteObjC.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'clang/lib/Rewrite/Frontend/RewriteObjC.cpp') diff --git a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp index 48649574c03..b7f54a8c8d3 100644 --- a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp +++ b/clang/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()) PointeeTy = BPT->getPointeeType(); if ((FPRetType = PointeeTy->getAs())) { - 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(funcType); if (!proto) return; - Type = proto->getResultType(); + Type = proto->getReturnType(); } else if (FieldDecl *FD = dyn_cast(Dcl)) { Loc = FD->getLocation(); @@ -2333,7 +2333,7 @@ void RewriteObjC::RewriteBlockLiteralFunctionDecl(FunctionDecl *FD) { const FunctionProtoType *proto = dyn_cast(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(); - 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(); - 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 ArgTypes; - QualType Res = FT->getResultType(); + QualType Res = FT->getReturnType(); bool HasBlockType = convertBlockPointerToFunctionPointer(Res); if (FTP) { -- cgit v1.2.3