summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/MacroInfo.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-04-23 20:40:50 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-04-23 20:40:50 +0000
commit713369b057bc6401e88abbc65cab1fc0a8f688e0 (patch)
tree1ff1bc32fe2a74cf60a317285bddb4407c2f57ba /clang/lib/Lex/MacroInfo.cpp
parent07e2d283a39a3b2a25dd642643e74e62686b5720 (diff)
downloadbcm5719-llvm-713369b057bc6401e88abbc65cab1fc0a8f688e0.tar.gz
bcm5719-llvm-713369b057bc6401e88abbc65cab1fc0a8f688e0.zip
[modules] Store a ModuleMacro* on an imported macro directive rather than duplicating the info within it.
llvm-svn: 235644
Diffstat (limited to 'clang/lib/Lex/MacroInfo.cpp')
-rw-r--r--clang/lib/Lex/MacroInfo.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Lex/MacroInfo.cpp b/clang/lib/Lex/MacroInfo.cpp
index d7f483192f1..dbc804490b2 100644
--- a/clang/lib/Lex/MacroInfo.cpp
+++ b/clang/lib/Lex/MacroInfo.cpp
@@ -235,6 +235,25 @@ void MacroDirective::dump() const {
Out << "\n";
}
+DefMacroDirective *
+DefMacroDirective::createImported(Preprocessor &PP, MacroInfo *MI,
+ SourceLocation Loc,
+ ModuleMacro *ImportedFrom) {
+ void *Mem = PP.getPreprocessorAllocator().Allocate(
+ sizeof(DefMacroDirective) + sizeof(MacroDirective::ImportData),
+ llvm::alignOf<DefMacroDirective>());
+ return new (Mem) DefMacroDirective(MI, Loc, ImportedFrom);
+}
+
+UndefMacroDirective *
+UndefMacroDirective::createImported(Preprocessor &PP, SourceLocation Loc,
+ ModuleMacro *ImportedFrom) {
+ void *Mem = PP.getPreprocessorAllocator().Allocate(
+ sizeof(UndefMacroDirective) + sizeof(MacroDirective::ImportData),
+ llvm::alignOf<UndefMacroDirective>());
+ return new (Mem) UndefMacroDirective(Loc, ImportedFrom);
+}
+
ModuleMacro *ModuleMacro::create(Preprocessor &PP, Module *OwningModule,
IdentifierInfo *II, MacroInfo *Macro,
ArrayRef<ModuleMacro *> Overrides) {
OpenPOWER on IntegriCloud