Author: axel
Date: Tue Oct 2 08:06:13 2012
New Revision: 165005
URL: http://llvm.org/viewvc/llvm-project?rev=165005&view=rev
Log:
Add redecls into their lexical DeclContext: this is what they assert on, and
the merging should have set it correctly.
This is especially relevant for templatedDecls that might be injected (and thus
have their DeclContext set to) somewhere completely different.
Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/test/Modules/Inputs/templates-top.h
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=165005&r1=165004&r2=165005&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Tue Oct 2 08:06:13 2012
@@ -1775,7 +1775,7 @@
if (!AddResult || Existing)
return;
- DeclContext *DC = New->getDeclContext()->getRedeclContext();
+ DeclContext *DC = New->getLexicalDeclContext();
if (DC->isTranslationUnit() && Reader.SemaObj) {
if (Reader.SemaObj->IdResolver.tryAddTopLevelDecl(New, New->getDeclName()))
Reader.RedeclsAddedToAST.insert(New);
Modified: cfe/trunk/test/Modules/Inputs/templates-top.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/templates-top.h?rev=165005&r1=165004&r2=165005&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/templates-top.h (original)
+++ cfe/trunk/test/Modules/Inputs/templates-top.h Tue Oct 2 08:06:13 2012
@@ -4,3 +4,14 @@
public:
void push_back(T);
};
+
+namespace A {
+ class Y {
+ template <typename T> friend class WhereAmI;
+ };
+}
+
+template <typename T> class A::WhereAmI {
+public:
+ static void func() {}
+};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits