summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-02 15:45:10 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-02 15:45:10 +0000
commit7b8e4bc83f161fccecf6a18c3925901e0e140274 (patch)
treeeb8da10346d2eddff0628f9f2b0449daf32d7162 /clang/lib/Serialization/ASTWriter.cpp
parent1280eb1d0684e44e045c8f984b2e16a2443ee10c (diff)
downloadbcm5719-llvm-7b8e4bc83f161fccecf6a18c3925901e0e140274.tar.gz
bcm5719-llvm-7b8e4bc83f161fccecf6a18c3925901e0e140274.zip
Implement name hiding for macro definitions within modules, such that
only the macro definitions from visible (sub)modules will actually be visible. This provides the same behavior for macros that r145640 provided for declarations. llvm-svn: 145683
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 1b554ef3c45..5580f90b83b 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -2423,7 +2423,7 @@ public:
if (isInterestingIdentifier(II, Macro)) {
DataLen += 2; // 2 bytes for builtin ID, flags
if (hasMacroDefinition(II, Macro))
- DataLen += 4;
+ DataLen += 8;
for (IdentifierResolver::iterator D = IdResolver.begin(II),
DEnd = IdResolver.end();
@@ -2465,9 +2465,12 @@ public:
Bits = (Bits << 1) | unsigned(II->isCPlusPlusOperatorKeyword());
clang::io::Emit16(Out, Bits);
- if (HasMacroDefinition)
+ if (HasMacroDefinition) {
clang::io::Emit32(Out, Writer.getMacroOffset(II));
-
+ clang::io::Emit32(Out,
+ Writer.inferSubmoduleIDFromLocation(Macro->getDefinitionLoc()));
+ }
+
// Emit the declaration IDs in reverse order, because the
// IdentifierResolver provides the declarations as they would be
// visible (e.g., the function "stat" would come before the struct
OpenPOWER on IntegriCloud