diff options
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/MacroInfo.cpp | 3 | ||||
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/Lex/MacroInfo.cpp b/lib/Lex/MacroInfo.cpp index 3d4ffb40c0..213e71132b 100644 --- a/lib/Lex/MacroInfo.cpp +++ b/lib/Lex/MacroInfo.cpp @@ -28,7 +28,8 @@ MacroInfo::MacroInfo(SourceLocation DefLoc) IsDisabled(false), IsUsed(false), IsAllowRedefinitionsWithoutWarning(false), - IsWarnIfUnused(false) { + IsWarnIfUnused(false), + FromASTFile(false) { } unsigned MacroInfo::getDefinitionLengthSlow(SourceManager &SM) const { diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index e19eb31335..163dbf413e 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -57,6 +57,19 @@ MacroInfo *Preprocessor::AllocateMacroInfo(SourceLocation L) { return MI; } +MacroInfo *Preprocessor::AllocateDeserializedMacroInfo(SourceLocation L, + unsigned SubModuleID) { + LLVM_STATIC_ASSERT(llvm::AlignOf<MacroInfo>::Alignment >= sizeof(SubModuleID), + "alignment for MacroInfo is less than the ID"); + MacroInfo *MI = + (MacroInfo*)BP.Allocate(sizeof(MacroInfo) + sizeof(SubModuleID), + llvm::AlignOf<MacroInfo>::Alignment); + new (MI) MacroInfo(L); + MI->FromASTFile = true; + MI->setOwningModuleID(SubModuleID); + return MI; +} + MacroDirective *Preprocessor::AllocateMacroDirective(MacroInfo *MI, SourceLocation Loc, bool isImported) { |