summaryrefslogtreecommitdiffstats
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2017-06-20 14:59:57 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2017-06-20 14:59:57 +0000
commit130156f32c5c7a9de4278d1607d552b6e8b665a4 (patch)
tree694eb54e20ca7c3c3707bab008b08987a6f26786 /lib/AST/DeclBase.cpp
parent65043f330617de8cc3740da0448c7e12110589b0 (diff)
D31187: Fix removal of out-of-line definitions.
Consider: struct MyClass { void f() {} } MyClass::f(){} // expected error redefinition of f. #1 Some clients (eg. cling) need to call removeDecl for the redefined (#1) decl. This patch enables us to remove the lookup entry is registered in the semantic decl context and not in the primary decl context of the lexical decl context where we currently are trying to remove it from. It is not trivial to test this piece and writing a full-blown unit test seems too much. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 032a20afa8..77ba6cf445 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -1352,7 +1352,7 @@ void DeclContext::removeDecl(Decl *D) {
// Remove only decls that have a name
if (!ND->getDeclName()) return;
- auto *DC = this;
+ auto *DC = D->getDeclContext();
do {
StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
if (Map) {