r189956 - ObjectiveC migrator. Refactor last patch on
Fariborz Jahanian
fjahanian at apple.com
Wed Sep 4 09:43:57 PDT 2013
Author: fjahanian
Date: Wed Sep 4 11:43:57 2013
New Revision: 189956
URL: http://llvm.org/viewvc/llvm-project?rev=189956&view=rev
Log:
ObjectiveC migrator. Refactor last patch on
annotations. (was r189892).
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=189956&r1=189955&r2=189956&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Sep 4 11:43:57 2013
@@ -1090,11 +1090,12 @@ void ObjCMigrateASTConsumer::migrateAddM
(MethodDecl->param_begin() == MethodDecl->param_end()))
return;
- bool ReturnCFAudited = false;
if (!MethodIsReturnAnnotated) {
RetEffect Ret = CE.getReturnValue();
- if (Ret.getObjKind() == RetEffect::CF && (Ret.isOwned() || Ret.notOwned()))
- ReturnCFAudited = true;
+ if (Ret.getObjKind() == RetEffect::CF && (Ret.isOwned() || Ret.notOwned())) {
+ AddCFAnnotations(Ctx, CE, MethodDecl, false);
+ return;
+ }
else if (!AuditedType(MethodDecl->getResultType()))
return;
}
@@ -1103,26 +1104,16 @@ void ObjCMigrateASTConsumer::migrateAddM
// Now, how about argument types.
llvm::ArrayRef<ArgEffect> AEArgs = CE.getArgs();
unsigned i = 0;
- bool ArgCFAudited = false;
for (ObjCMethodDecl::param_const_iterator pi = MethodDecl->param_begin(),
pe = MethodDecl->param_end(); pi != pe; ++pi, ++i) {
const ParmVarDecl *pd = *pi;
ArgEffect AE = AEArgs[i];
- if (AE == DecRef /*CFConsumed annotated*/ || AE == IncRef) {
- if ((AE == DecRef && !pd->getAttr<CFConsumedAttr>()) ||
- AE == IncRef)
- ArgCFAudited = true;
- }
- else {
- QualType AT = pd->getType();
- if (!AuditedType(AT)) {
- AddCFAnnotations(Ctx, CE, MethodDecl, MethodIsReturnAnnotated);
- return;
- }
+ if ((AE == DecRef && !pd->getAttr<CFConsumedAttr>()) || AE == IncRef ||
+ !AuditedType(pd->getType())) {
+ AddCFAnnotations(Ctx, CE, MethodDecl, MethodIsReturnAnnotated);
+ return;
}
}
- if (ReturnCFAudited || ArgCFAudited)
- AddCFAnnotations(Ctx, CE, MethodDecl, MethodIsReturnAnnotated);
return;
}
More information about the cfe-commits
mailing list