r194590 - [objcmt] Use FileIDs directly instead of their hash value.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Nov 13 10:20:31 PST 2013
Author: akirtzidis
Date: Wed Nov 13 12:20:31 2013
New Revision: 194590
URL: http://llvm.org/viewvc/llvm-project?rev=194590&view=rev
Log:
[objcmt] Use FileIDs directly instead of their hash value.
No functionality change.
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=194590&r1=194589&r2=194590&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Nov 13 12:20:31 2013
@@ -78,7 +78,7 @@ class ObjCMigrateASTConsumer : public AS
public:
std::string MigrateDir;
unsigned ASTMigrateActions;
- unsigned FileId;
+ FileID FileId;
const TypedefDecl *NSIntegerTypedefed;
const TypedefDecl *NSUIntegerTypedefed;
OwningPtr<NSAPI> NSAPIObj;
@@ -100,7 +100,7 @@ public:
bool isOutputFile = false)
: MigrateDir(migrateDir),
ASTMigrateActions(astMigrateActions),
- FileId(0), NSIntegerTypedefed(0), NSUIntegerTypedefed(0),
+ NSIntegerTypedefed(0), NSUIntegerTypedefed(0),
Remapper(remapper), FileMgr(fileMgr), PPRec(PPRec), PP(PP),
IsOutputFile(isOutputFile) { }
@@ -762,10 +762,10 @@ bool ObjCMigrateASTConsumer::migrateNSEn
}
else
return false;
- unsigned FileIdOfTypedefDcl =
- PP.getSourceManager().getFileID(TypedefDcl->getLocation()).getHashValue();
- unsigned FileIdOfEnumDcl =
- PP.getSourceManager().getFileID(EnumDcl->getLocation()).getHashValue();
+ FileID FileIdOfTypedefDcl =
+ PP.getSourceManager().getFileID(TypedefDcl->getLocation());
+ FileID FileIdOfEnumDcl =
+ PP.getSourceManager().getFileID(EnumDcl->getLocation());
if (FileIdOfTypedefDcl != FileIdOfEnumDcl)
return false;
}
@@ -1247,7 +1247,7 @@ void ObjCMigrateASTConsumer::AnnotateImp
return;
if (!Ctx.Idents.get("CF_IMPLICIT_BRIDGING_ENABLED").hasMacroDefinition()) {
CFFunctionIBCandidates.clear();
- FileId = 0;
+ FileId = FileID();
return;
}
// Insert CF_IMPLICIT_BRIDGING_ENABLE/CF_IMPLICIT_BRIDGING_DISABLED
@@ -1272,7 +1272,7 @@ void ObjCMigrateASTConsumer::AnnotateImp
}
commit.insertAfterToken(EndLoc, PragmaString);
Editor->commit(commit);
- FileId = 0;
+ FileId = FileID();
CFFunctionIBCandidates.clear();
}
@@ -1292,14 +1292,14 @@ void ObjCMigrateASTConsumer::migrateCFAn
CF_BRIDGING_KIND AuditKind = migrateAddFunctionAnnotation(Ctx, FuncDecl);
if (AuditKind == CF_BRIDGING_ENABLE) {
CFFunctionIBCandidates.push_back(Decl);
- if (!FileId)
- FileId = PP.getSourceManager().getFileID(Decl->getLocation()).getHashValue();
+ if (FileId.isInvalid())
+ FileId = PP.getSourceManager().getFileID(Decl->getLocation());
}
else if (AuditKind == CF_BRIDGING_MAY_INCLUDE) {
if (!CFFunctionIBCandidates.empty()) {
CFFunctionIBCandidates.push_back(Decl);
- if (!FileId)
- FileId = PP.getSourceManager().getFileID(Decl->getLocation()).getHashValue();
+ if (FileId.isInvalid())
+ FileId = PP.getSourceManager().getFileID(Decl->getLocation());
}
}
else
@@ -1596,9 +1596,9 @@ void ObjCMigrateASTConsumer::HandleTrans
if (ASTMigrateActions & FrontendOptions::ObjCMT_MigrateDecls) {
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) {
+ FileID FID = PP.getSourceManager().getFileID((*D)->getLocation());
+ if (!FID.isInvalid())
+ if (!FileId.isInvalid() && FileId != FID) {
if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
AnnotateImplicitBridging(Ctx);
}
More information about the cfe-commits
mailing list