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/RewriteModernObjC.cpp b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index 759e57e..9b86492 100644
--- a/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/clang/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -976,7 +976,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) {
@@ -1259,8 +1259,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
@@ -1273,7 +1273,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
@@ -2272,7 +2272,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();
@@ -2446,7 +2446,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();
@@ -2765,9 +2765,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);
ReplaceStmt(Exp, CE);
return CE;
}
@@ -2902,9 +2901,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);
ReplaceStmt(Exp, CE);
return CE;
}
@@ -3075,9 +3073,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);
ReplaceStmt(Exp, CE);
return CE;
}
@@ -3334,7 +3331,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())
@@ -3680,8 +3677,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
@@ -4226,7 +4223,7 @@
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 @@
// 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) {