r206204 - PR19411: Walk lexical parents, not semantic parents, when determining whether a
Richard Smith
richard-llvm at metafoo.co.uk
Mon Apr 14 13:23:58 PDT 2014
Author: rsmith
Date: Mon Apr 14 15:23:58 2014
New Revision: 206204
URL: http://llvm.org/viewvc/llvm-project?rev=206204&view=rev
Log:
PR19411: Walk lexical parents, not semantic parents, when determining whether a
DeclContext is (lexically) within a C language linkage specification.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/test/CodeGenCXX/extern-c.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=206204&r1=206203&r2=206204&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Mon Apr 14 15:23:58 2014
@@ -837,7 +837,7 @@ static bool isLinkageSpecContext(const D
while (DC->getDeclKind() != Decl::TranslationUnit) {
if (DC->getDeclKind() == Decl::LinkageSpec)
return cast<LinkageSpecDecl>(DC)->getLanguage() == ID;
- DC = DC->getParent();
+ DC = DC->getLexicalParent();
}
return false;
}
Modified: cfe/trunk/test/CodeGenCXX/extern-c.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/extern-c.cpp?rev=206204&r1=206203&r2=206204&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/extern-c.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/extern-c.cpp Mon Apr 14 15:23:58 2014
@@ -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()
+}
More information about the cfe-commits
mailing list