aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-03 05:11:33 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-03 05:11:33 +0000
commitb2dbfd8669282915c9466ba88c66f9791b946efa (patch)
treea449c381458f399c735c137e2aea30877f287f42 /lib/Serialization/ASTWriter.cpp
parent670b2e6e9e75ca5d816899f6c1ac97137ba6f206 (diff)
[modules] If a submodule has re-definitions of the same macro, only the last definition will be used as the "exported" one.
Fixes rdar://13562262 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r--lib/Serialization/ASTWriter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 033d48c147..6893b5003f 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -2937,6 +2937,7 @@ class ASTIdentifierTableTrait {
if (!MD)
return 0;
+ SubmoduleID OrigModID = ModID;
bool isUndefined = false;
Optional<bool> isPublic;
for (; MD; MD = MD->getPrevious()) {
@@ -2954,6 +2955,11 @@ class ASTIdentifierTableTrait {
isUndefined = false;
isPublic = Optional<bool>();
}
+ // We are looking for a definition in a different submodule than the one
+ // that we started with. If a submodule has re-definitions of the same
+ // macro, only the last definition will be used as the "exported" one.
+ if (ModID == OrigModID)
+ continue;
if (DefMacroDirective *DefMD = dyn_cast<DefMacroDirective>(MD)) {
if (!isUndefined && (!isPublic.hasValue() || isPublic.getValue()))