diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-14 20:23:58 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-04-14 20:23:58 +0000 |
| commit | ac9c9a006ff960163b42511142be95bc2486a9b3 (patch) | |
| tree | f011a045f8fdc903e77b24819b2dc41c45467de0 /clang | |
| parent | 6e63f50b2ac24c4cd6d6f82e92381b22e059df73 (diff) | |
| download | bcm5719-llvm-ac9c9a006ff960163b42511142be95bc2486a9b3.tar.gz bcm5719-llvm-ac9c9a006ff960163b42511142be95bc2486a9b3.zip | |
PR19411: Walk lexical parents, not semantic parents, when determining whether a
DeclContext is (lexically) within a C language linkage specification.
llvm-svn: 206204
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/AST/DeclBase.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/extern-c.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 1de1fe21de3..c12f53c6766 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -837,7 +837,7 @@ static bool isLinkageSpecContext(const DeclContext *DC, while (DC->getDeclKind() != Decl::TranslationUnit) { if (DC->getDeclKind() == Decl::LinkageSpec) return cast<LinkageSpecDecl>(DC)->getLanguage() == ID; - DC = DC->getParent(); + DC = DC->getLexicalParent(); } return false; } diff --git a/clang/test/CodeGenCXX/extern-c.cpp b/clang/test/CodeGenCXX/extern-c.cpp index 63bb177b84d..fefb216ea1c 100644 --- a/clang/test/CodeGenCXX/extern-c.cpp +++ b/clang/test/CodeGenCXX/extern-c.cpp @@ -66,3 +66,10 @@ extern "C" { // CHECK-NOT: @unused // CHECK-NOT: @duplicate_internal } + +namespace PR19411 { + struct A { void f(); }; + extern "C" void A::f() { void g(); g(); } + // CHECK-LABEL: @_ZN7PR194111A1fEv( + // CHECK: call void @g() +} |

