r270089 - [MS ABI] Ignore transparent contexts when determining the effective context

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 11:15:56 PDT 2016


Author: majnemer
Date: Thu May 19 13:15:53 2016
New Revision: 270089

URL: http://llvm.org/viewvc/llvm-project?rev=270089&view=rev
Log:
[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.

Modified:
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle-ms.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=270089&r1=270088&r2=270089&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu May 19 13:15:53 2016
@@ -94,7 +94,7 @@ static const DeclContext *getEffectiveDe
     return getEffectiveDeclContext(cast<Decl>(DC));
   }
 
-  return DC;
+  return DC->getRedeclContext();
 }
 
 static const DeclContext *getEffectiveParentContext(const DeclContext *DC) {

Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=270089&r1=270088&r2=270089&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Thu May 19 13:15:53 2016
@@ -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 at N@@3HA"




More information about the cfe-commits mailing list