summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-04-23 23:29:05 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-04-23 23:29:05 +0000
commit50474bf5d2356feab24d985cac3ea91f856df59b (patch)
tree0936843b327d846c0a5f6775361e71e7bb5768ba /clang/lib/Serialization
parent43fb8a157b270e70d553231c8561a2efd012c774 (diff)
downloadbcm5719-llvm-50474bf5d2356feab24d985cac3ea91f856df59b.tar.gz
bcm5719-llvm-50474bf5d2356feab24d985cac3ea91f856df59b.zip
[modules] Refactor creation of ModuleMacros and create them when importing from local submodules.
llvm-svn: 235669
Diffstat (limited to 'clang/lib/Serialization')
-rw-r--r--clang/lib/Serialization/ASTReader.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 847f1ff8817..39aac12328f 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -1735,9 +1735,7 @@ struct ASTReader::ModuleMacroInfo {
}
MacroDirective *import(Preprocessor &PP, SourceLocation ImportLoc) const {
- if (auto *MI = MM->getMacroInfo())
- return PP.AllocateDefMacroDirective(MI, ImportLoc, MM);
- return PP.AllocateUndefMacroDirective(ImportLoc, MM);
+ return PP.AllocateImportedMacroDirective(MM, ImportLoc);
}
};
@@ -1843,16 +1841,17 @@ void ASTReader::resolvePendingMacro(IdentifierInfo *II,
ModuleMacro *MM = nullptr;
if (SubmoduleID ImportedFrom = getGlobalSubmoduleID(M, Record[Idx++]))
MM = PP.getModuleMacro(getSubmodule(ImportedFrom), II);
- DefMacroDirective *DefMD = PP.AllocateDefMacroDirective(MI, Loc, MM);
- DefMD->setAmbiguous(IsAmbiguous);
- MD = DefMD;
+ MD = MM ? PP.AllocateImportedMacroDirective(MM, Loc)
+ : PP.AllocateDefMacroDirective(MI, Loc);
+ cast<DefMacroDirective>(MD)->setAmbiguous(IsAmbiguous);
break;
}
case MacroDirective::MD_Undefine: {
ModuleMacro *MM = nullptr;
if (SubmoduleID ImportedFrom = getGlobalSubmoduleID(M, Record[Idx++]))
MM = PP.getModuleMacro(getSubmodule(ImportedFrom), II);
- MD = PP.AllocateUndefMacroDirective(Loc, MM);
+ MD = MM ? PP.AllocateImportedMacroDirective(MM, Loc)
+ : PP.AllocateUndefMacroDirective(Loc);
break;
}
case MacroDirective::MD_Visibility:
OpenPOWER on IntegriCloud