Tweak submodule ID handling in the AST writer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2011-12-12 23:17:57 +00:00
Родитель ba96ffcb2a
Коммит bab9f4afae
2 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -1970,7 +1970,7 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) {
if (!Mod->Imports.empty()) {
Record.clear();
for (unsigned I = 0, N = Mod->Imports.size(); I != N; ++I) {
unsigned ImportedID = SubmoduleIDs[Mod->Imports[I]];
unsigned ImportedID = getSubmoduleID(Mod->Imports[I]);
assert(ImportedID && "Unknown submodule!");
Record.push_back(ImportedID);
}
@ -1981,10 +1981,14 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) {
if (!Mod->Exports.empty()) {
Record.clear();
for (unsigned I = 0, N = Mod->Exports.size(); I != N; ++I) {
unsigned ExportedID = SubmoduleIDs[Mod->Exports[I].getPointer()];
assert((ExportedID || !Mod->Exports[I].getPointer()) &&
"Unknown submodule!");
Record.push_back(ExportedID);
if (Module *Exported = Mod->Exports[I].getPointer()) {
unsigned ExportedID = SubmoduleIDs[Exported];
assert(ExportedID > 0 && "Unknown submodule ID?");
Record.push_back(ExportedID);
} else {
Record.push_back(0);
}
Record.push_back(Mod->Exports[I].getInt());
}
Stream.EmitRecord(SUBMODULE_EXPORTS, Record);

Просмотреть файл

@ -976,7 +976,6 @@ void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {
void ASTDeclWriter::VisitImportDecl(ImportDecl *D) {
VisitDecl(D);
Writer.SubmoduleIDs[D->getImportedModule()];
ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
Record.push_back(!IdentifierLocs.empty());
if (IdentifierLocs.empty()) {