aboutsummaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorAxel Naumann <Axel.Naumann@cern.ch>2012-10-02 12:18:46 +0000
committerAxel Naumann <Axel.Naumann@cern.ch>2012-10-02 12:18:46 +0000
commit38c3bb40c2cef630c236f3f455ea98999990b8ee (patch)
treeba0f098cca52ab8cbffdd81f342fc5c85442294f /lib/Serialization/ASTReaderDecl.cpp
parentf88cd53676b1a2bf40a37d0ad23d81afa9f85544 (diff)
Only those InterestingDecls that got added to the AST should be passed to the ASTConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 85740de15b..e770c06519 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -1777,9 +1777,11 @@ ASTDeclReader::FindExistingResult::~FindExistingResult() {
DeclContext *DC = New->getDeclContext()->getRedeclContext();
if (DC->isTranslationUnit() && Reader.SemaObj) {
- Reader.SemaObj->IdResolver.tryAddTopLevelDecl(New, New->getDeclName());
+ if (Reader.SemaObj->IdResolver.tryAddTopLevelDecl(New, New->getDeclName()))
+ Reader.RedeclsAddedToAST.insert(New);
} else if (DC->isNamespace()) {
DC->addDecl(New);
+ Reader.RedeclsAddedToAST.insert(New);
}
}
@@ -2154,7 +2156,13 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
// AST consumer might need to know about, queue it.
// We don't pass it to the consumer immediately because we may be in recursive
// loading, and some declarations may still be initializing.
- if (isConsumerInterestedIn(D))
+ if (getContext().getLangOpts().Modules) {
+ if (RedeclsAddedToAST.count(D)) {
+ RedeclsAddedToAST.erase(D);
+ if (isConsumerInterestedIn(D))
+ InterestingDecls.push_back(D);
+ }
+ } else if (isConsumerInterestedIn(D))
InterestingDecls.push_back(D);
return D;