diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-25 16:55:45 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-25 16:55:45 +0000 |
commit | 314cc81b8caacd6f9b3f74c4e32ac9403d8d4052 (patch) | |
tree | 4f031e0740266d6687313f6792788bb5af6352a0 /clang/lib/ARCMigrate/ObjCMT.cpp | |
parent | 68855fe3c912c1cf183fe01621ea4f38a2dd7752 (diff) | |
download | bcm5719-llvm-314cc81b8caacd6f9b3f74c4e32ac9403d8d4052.tar.gz bcm5719-llvm-314cc81b8caacd6f9b3f74c4e32ac9403d8d4052.zip |
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
Diffstat (limited to 'clang/lib/ARCMigrate/ObjCMT.cpp')
-rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index ace5bfd53a5..af88cb6bc1f 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/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; } |