diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-10-09 23:05:51 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-10-09 23:05:51 +0000 |
commit | cb28f9d7adfc51225fe1553052608e5a5c0442b6 (patch) | |
tree | 5428baebc99503de6855f0a418c671d9d7c96527 /clang/lib/Serialization/Module.cpp | |
parent | 79258ca2ccb824371e5720de253f34b5e322b520 (diff) | |
download | bcm5719-llvm-cb28f9d7adfc51225fe1553052608e5a5c0442b6.tar.gz bcm5719-llvm-cb28f9d7adfc51225fe1553052608e5a5c0442b6.zip |
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
Diffstat (limited to 'clang/lib/Serialization/Module.cpp')
-rw-r--r-- | clang/lib/Serialization/Module.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Serialization/Module.cpp b/clang/lib/Serialization/Module.cpp index a5f709153c7..b6204f9478e 100644 --- a/clang/lib/Serialization/Module.cpp +++ b/clang/lib/Serialization/Module.cpp @@ -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); |