[cfe-commits] r152022 - in /cfe/trunk: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/mangle-std-externc.cpp
James Molloy
james.molloy at arm.com
Mon Mar 5 01:59:43 PST 2012
Author: jamesm
Date: Mon Mar 5 03:59:43 2012
New Revision: 152022
URL: http://llvm.org/viewvc/llvm-project?rev=152022&view=rev
Log:
Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.
Added:
cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp (with props)
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp
Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=152022&r1=152021&r2=152022&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Mon Mar 5 03:59:43 2012
@@ -553,8 +553,7 @@
return;
}
- while (isa<LinkageSpecDecl>(DC))
- DC = getEffectiveParentContext(DC);
+ DC = IgnoreLinkageSpecDecls(DC);
if (DC->isTranslationUnit() || isStdNamespace(DC)) {
// Check if we have a template.
@@ -594,7 +593,8 @@
void CXXNameMangler::mangleUnscopedName(const NamedDecl *ND) {
// <unscoped-name> ::= <unqualified-name>
// ::= St <unqualified-name> # ::std::
- if (isStdNamespace(getEffectiveDeclContext(ND)))
+
+ if (isStdNamespace(IgnoreLinkageSpecDecls(getEffectiveDeclContext(ND))))
Out << "St";
mangleUnqualifiedName(ND);
@@ -1393,8 +1393,7 @@
// ::= # empty
// ::= <substitution>
- while (isa<LinkageSpecDecl>(DC))
- DC = getEffectiveParentContext(DC);
+ DC = IgnoreLinkageSpecDecls(DC);
if (DC->isTranslationUnit())
return;
Added: cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp?rev=152022&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp Mon Mar 5 03:59:43 2012
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -DNS=std -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-STD
+// RUN: %clang_cc1 %s -DNS=n -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-N
+
+// _ZNSt1DISt1CE1iE = std::D<std::C>::i
+// CHECK-STD: @_ZNSt1DISt1CE1iE =
+
+// _ZN1n1DINS_1CEE1iE == n::D<n::C>::i
+// CHECK-N: @_ZN1n1DINS_1CEE1iE =
+
+namespace NS {
+ extern "C" {
+ class C {
+ };
+ }
+
+ template <class T>
+ class D {
+ public:
+ static int i;
+ };
+
+}
+
+
+int f() {
+ return NS::D<NS::C>::i;
+}
Propchange: cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CodeGenCXX/mangle-std-externc.cpp
------------------------------------------------------------------------------
svn:keywords = Rev Date Author URL Id
More information about the cfe-commits
mailing list