From 9a0c2517ad81a849ec57558a3ce4283ce78eda77 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 19 May 2016 18:15:53 +0000 Subject: [PATCH] [MS ABI] Ignore transparent contexts when determining the effective context We didn't skip over extern "C++" contexts, causing us to mangle things which don't need to be mangled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270089 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/MicrosoftMangle.cpp | 2 +- test/CodeGenCXX/mangle-ms.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 774dab0572..a88e2a621c 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -94,7 +94,7 @@ static const DeclContext *getEffectiveDeclContext(const Decl *D) { return getEffectiveDeclContext(cast(DC)); } - return DC; + return DC->getRedeclContext(); } static const DeclContext *getEffectiveParentContext(const DeclContext *DC) { diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp index c82fca49f6..ee0f50e5e2 100644 --- a/test/CodeGenCXX/mangle-ms.cpp +++ b/test/CodeGenCXX/mangle-ms.cpp @@ -4,6 +4,11 @@ int a; // CHECK-DAG: @"\01?a@@3HA" +extern "C++" { +static int __attribute__((used)) ignore_transparent_context; +// CHECK-DAG: @ignore_transparent_context +} + namespace N { int b; // CHECK-DAG: @"\01?b@N@@3HA" -- 2.40.0