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
diff --git a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
index 4864957..b7f54a8 100644
--- a/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
+++ b/clang/lib/Rewrite/Frontend/RewriteObjC.cpp
@@ -810,7 +810,7 @@
// 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 @@
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 @@
//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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
// 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) {