Author: axel
Date: Thu Oct 4 02:34:43 2012
New Revision: 165215
URL: http://llvm.org/viewvc/llvm-project?rev=165215&view=rev
Log:
Fix r165005: The lexical DeclContext is not the right place to make a decision
about whether we need to call tryAddTopLevelDecl or not. That call should be
made when the DeclContext's redeclaration context is the translation unit.
Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=165215&r1=165214&r2=165215&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Oct 4 02:34:43 2012
@@ -1781,11 +1781,13 @@
if (!AddResult || Existing)
return;
- DeclContext *DC = New->getLexicalDeclContext();
- if (DC->isTranslationUnit() && Reader.SemaObj) {
+ if (New->getDeclContext()->getRedeclContext()->isTranslationUnit()
+ && Reader.SemaObj) {
Reader.SemaObj->IdResolver.tryAddTopLevelDecl(New, New->getDeclName());
- } else if (DC->isNamespace()) {
- DC->addDecl(New);
+ } else {
+ DeclContext *DC = New->getLexicalDeclContext();
+ if (DC->isNamespace())
+ DC->addDecl(New);
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits