diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-22 21:12:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-22 21:12:51 +0000 |
commit | baa74bd3968028d8e5b10ee9b50d0dceb41e85a9 (patch) | |
tree | 40b17341df9746e1cc6ebc8856671e7867da10e9 /lib/Lex | |
parent | a8a0f769ff4113a7f98c232fb0fc773a65371559 (diff) |
[modules] When a MacroInfo object is deserialized, allocate and store its submodule ID.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177760 91177308-0d34-0410-b5e6-96231b3b80d8
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) { |