r188846 - ObjectiveC migrator. make sure to embed audited
Fariborz Jahanian
fjahanian at apple.com
Tue Aug 20 16:35:26 PDT 2013
Author: fjahanian
Date: Tue Aug 20 18:35:26 2013
New Revision: 188846
URL: http://llvm.org/viewvc/llvm-project?rev=188846&view=rev
Log:
ObjectiveC migrator. make sure to embed audited
candidate functions in their CF_IMPLICIT_BRIDGING_ENABLED
pragma before exiting the header file.
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=188846&r1=188845&r2=188846&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Aug 20 18:35:26 2013
@@ -64,6 +64,7 @@ public:
bool MigrateLiterals;
bool MigrateSubscripting;
bool MigrateProperty;
+ unsigned FileId;
OwningPtr<NSAPI> NSAPIObj;
OwningPtr<edit::EditedSource> Editor;
FileRemapper &Remapper;
@@ -86,7 +87,7 @@ public:
: MigrateDir(migrateDir),
MigrateLiterals(migrateLiterals),
MigrateSubscripting(migrateSubscripting),
- MigrateProperty(migrateProperty),
+ MigrateProperty(migrateProperty), FileId(0),
Remapper(remapper), FileMgr(fileMgr), PPRec(PPRec), PP(PP),
IsOutputFile(isOutputFile) { }
@@ -799,6 +800,7 @@ AuditedType (QualType AT, bool &IsPonite
void ObjCMigrateASTConsumer::AnnotateImplicitBridging(ASTContext &Ctx) {
if (!Ctx.Idents.get("CF_IMPLICIT_BRIDGING_ENABLED").hasMacroDefinition()) {
CFFunctionIBCandidates.clear();
+ FileId = 0;
return;
}
// Insert CF_IMPLICIT_BRIDGING_ENABLE/CF_IMPLICIT_BRIDGING_DISABLED
@@ -819,16 +821,13 @@ void ObjCMigrateASTConsumer::AnnotateImp
EndLoc = Tok.getLocation();
commit.insertAfterToken(EndLoc, PragmaString);
Editor->commit(commit);
-
+ FileId = 0;
CFFunctionIBCandidates.clear();
}
void ObjCMigrateASTConsumer::migrateCFFunctions(
ASTContext &Ctx,
const FunctionDecl *FuncDecl) {
-
- // FileID FID = PP.getSourceManager().getFileID(FuncDecl->getLocation());
-
if (FuncDecl->hasAttr<CFAuditedTransferAttr>()) {
assert(CFFunctionIBCandidates.empty() &&
"Cannot have audited functions inside user "
@@ -838,8 +837,11 @@ void ObjCMigrateASTConsumer::migrateCFFu
// Finction must be annotated first.
bool Audited = migrateAddFunctionAnnotation(Ctx, FuncDecl);
- if (Audited)
+ if (Audited) {
CFFunctionIBCandidates.push_back(FuncDecl);
+ if (!FileId)
+ FileId = PP.getSourceManager().getFileID(FuncDecl->getLocation()).getHashValue();
+ }
else if (!CFFunctionIBCandidates.empty())
AnnotateImplicitBridging(Ctx);
}
@@ -938,6 +940,13 @@ void ObjCMigrateASTConsumer::HandleTrans
if (MigrateProperty) {
for (DeclContext::decl_iterator D = TU->decls_begin(), DEnd = TU->decls_end();
D != DEnd; ++D) {
+ if (unsigned FID =
+ PP.getSourceManager().getFileID((*D)->getLocation()).getHashValue())
+ if (FileId && FileId != FID) {
+ assert(!CFFunctionIBCandidates.empty());
+ AnnotateImplicitBridging(Ctx);
+ }
+
if (ObjCInterfaceDecl *CDecl = dyn_cast<ObjCInterfaceDecl>(*D))
migrateObjCInterfaceDecl(Ctx, CDecl);
else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(*D))
More information about the cfe-commits
mailing list