summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
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/Lex/PPDirectives.cpp
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/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 9084915dcd9..7c0edfc876d 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -62,17 +62,13 @@ MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L,
return MI;
}
-DefMacroDirective *
-Preprocessor::AllocateDefMacroDirective(MacroInfo *MI, SourceLocation Loc,
- ModuleMacro *MM) {
- if (MM) return DefMacroDirective::createImported(*this, MI, Loc, MM);
+DefMacroDirective *Preprocessor::AllocateDefMacroDirective(MacroInfo *MI,
+ SourceLocation Loc) {
return new (BP) DefMacroDirective(MI, Loc);
}
UndefMacroDirective *
-Preprocessor::AllocateUndefMacroDirective(SourceLocation UndefLoc,
- ModuleMacro *MM) {
- if (MM) return UndefMacroDirective::createImported(*this, UndefLoc, MM);
+Preprocessor::AllocateUndefMacroDirective(SourceLocation UndefLoc) {
return new (BP) UndefMacroDirective(UndefLoc);
}
@@ -82,6 +78,15 @@ Preprocessor::AllocateVisibilityMacroDirective(SourceLocation Loc,
return new (BP) VisibilityMacroDirective(Loc, isPublic);
}
+MacroDirective *
+Preprocessor::AllocateImportedMacroDirective(ModuleMacro *MM,
+ SourceLocation Loc) {
+ if (auto *MI = MM->getMacroInfo())
+ return DefMacroDirective::createImported(*this, MI, Loc, MM);
+ else
+ return UndefMacroDirective::createImported(*this, Loc, MM);
+}
+
/// \brief Read and discard all tokens remaining on the current line until
/// the tok::eod token is found.
void Preprocessor::DiscardUntilEndOfDirective() {
@@ -1784,7 +1789,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc,
assert(!CurSubmodule && "should not have marked this as a module yet");
CurSubmodule = BuildingModule.getModule();
- EnterSubmodule(CurSubmodule);
+ EnterSubmodule(CurSubmodule, HashLoc);
EnterAnnotationToken(*this, HashLoc, End, tok::annot_module_begin,
CurSubmodule);
OpenPOWER on IntegriCloud