diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2017-06-20 14:59:57 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2017-06-20 14:59:57 +0000 |
commit | 2e4159801d8588b50b126af4e3233e03f6725f2e (patch) | |
tree | 8d5eb0e4c24bb24c717867ade6b081299329b027 | |
parent | e437b6a52b7def19dfc61f72f71d6c63b5f623cc (diff) | |
download | llvm-2e4159801d8588b50b126af4e3233e03f6725f2e.zip llvm-2e4159801d8588b50b126af4e3233e03f6725f2e.tar.gz llvm-2e4159801d8588b50b126af4e3233e03f6725f2e.tar.bz2 |
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.
llvm-svn: 305799
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 032a20a..77ba6cf 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/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) { |