diff options
author | Axel Naumann <Axel.Naumann@cern.ch> | 2012-10-04 07:34:43 +0000 |
---|---|---|
committer | Axel Naumann <Axel.Naumann@cern.ch> | 2012-10-04 07:34:43 +0000 |
commit | c6848efaac6836930ac9558060628cb094db3ff9 (patch) | |
tree | 0930ac0de7c86c8e5cf8fac6acc31d1e75f71561 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | cb13fff13d939c70183a9277b7449aa15be6268e (diff) | |
download | bcm5719-llvm-c6848efaac6836930ac9558060628cb094db3ff9.tar.gz bcm5719-llvm-c6848efaac6836930ac9558060628cb094db3ff9.zip |
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.
llvm-svn: 165215
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index d9243f62e5a..762ad01b51e 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1781,11 +1781,13 @@ ASTDeclReader::FindExistingResult::~FindExistingResult() { 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); } } |