Rework the (de-)serialization of macros, as stored in
authorDouglas Gregor <dgregor@apple.com>
Tue, 9 Oct 2012 23:05:51 +0000 (23:05 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 9 Oct 2012 23:05:51 +0000 (23:05 +0000)
commitcb28f9d7adfc51225fe1553052608e5a5c0442b6
tree5428baebc99503de6855f0a418c671d9d7c96527
parent79258ca2ccb824371e5720de253f34b5e322b520
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
26 files changed:
clang/include/clang/AST/ASTConsumer.h
clang/include/clang/AST/ASTMutationListener.h
clang/include/clang/Lex/PPMutationListener.h [new file with mode: 0644]
clang/include/clang/Lex/Preprocessor.h
clang/include/clang/Serialization/ASTBitCodes.h
clang/include/clang/Serialization/ASTDeserializationListener.h
clang/include/clang/Serialization/ASTReader.h
clang/include/clang/Serialization/ASTWriter.h
clang/include/clang/Serialization/Module.h
clang/lib/Frontend/ChainedIncludesSource.cpp
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Lex/Preprocessor.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/GeneratePCH.cpp
clang/lib/Serialization/Module.cpp
clang/test/Modules/Inputs/macros_left.h [new file with mode: 0644]
clang/test/Modules/Inputs/macros_other.h [new file with mode: 0644]
clang/test/Modules/Inputs/macros_right.h [new file with mode: 0644]
clang/test/Modules/Inputs/macros_top.h [new file with mode: 0644]
clang/test/PCH/Inputs/chain-macro-override1.h
clang/test/PCH/Inputs/chain-macro-override2.h
clang/test/PCH/chain-macro-override.c