Rework the (de-)serialization of macros, as stored in
MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
This commit is contained in:
@@ -25,9 +25,11 @@ ModuleFile::ModuleFile(ModuleKind Kind, unsigned Generation)
|
||||
Generation(Generation), SizeInBits(0),
|
||||
LocalNumSLocEntries(0), SLocEntryBaseID(0),
|
||||
SLocEntryBaseOffset(0), SLocEntryOffsets(0),
|
||||
SLocFileOffsets(0), LocalNumIdentifiers(0),
|
||||
SLocFileOffsets(0), LocalNumIdentifiers(0),
|
||||
IdentifierOffsets(0), BaseIdentifierID(0), IdentifierTableData(0),
|
||||
IdentifierLookupTable(0), BasePreprocessedEntityID(0),
|
||||
IdentifierLookupTable(0),
|
||||
LocalNumMacros(0), MacroOffsets(0),
|
||||
BasePreprocessedEntityID(0),
|
||||
PreprocessedEntityOffsets(0), NumPreprocessedEntities(0),
|
||||
LocalNumHeaderFileInfos(0),
|
||||
HeaderFileInfoTableData(0), HeaderFileInfoTable(0),
|
||||
@@ -91,6 +93,10 @@ void ModuleFile::dump() {
|
||||
<< " Number of identifiers: " << LocalNumIdentifiers << '\n';
|
||||
dumpLocalRemap("Identifier ID local -> global map", IdentifierRemap);
|
||||
|
||||
llvm::errs() << " Base macro ID: " << BaseMacroID << '\n'
|
||||
<< " Number of macros: " << LocalNumMacros << '\n';
|
||||
dumpLocalRemap("Macro ID local -> global map", MacroRemap);
|
||||
|
||||
llvm::errs() << " Base submodule ID: " << BaseSubmoduleID << '\n'
|
||||
<< " Number of submodules: " << LocalNumSubmodules << '\n';
|
||||
dumpLocalRemap("Submodule ID local -> global map", SubmoduleRemap);
|
||||
|
||||
Reference in New Issue
Block a user