void CXXNameMangler::mangleNestedName(const NamedDecl *ND) {
// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
// ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
- // FIXME: no class template support
+
Out << 'N';
if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(ND))
mangleQualifiers(Qualifiers::fromCVRMask(Method->getTypeQualifiers()));
}
bool CXXNameMangler::mangleSubstitution(QualType T) {
+ if (!T.getCVRQualifiers()) {
+ if (const RecordType *RT = T->getAs<RecordType>())
+ return mangleSubstitution(RT->getDecl());
+ }
+
uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
return mangleSubstitution(TypePtr);
}
void CXXNameMangler::addSubstitution(QualType T) {
+ if (!T.getCVRQualifiers()) {
+ if (const RecordType *RT = T->getAs<RecordType>()) {
+ addSubstitution(RT->getDecl());
+ return;
+ }
+ }
+
uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
addSubstitution(TypePtr);
}
assert(!isa<CXXDestructorDecl>(D) &&
"Use mangleCXXDtor for destructor decls!");
+ PrettyStackTraceDecl CrashInfo(const_cast<NamedDecl *>(D), SourceLocation(),
+ Context.getSourceManager(),
+ "Mangling declaration");
+
CXXNameMangler Mangler(Context, os);
if (!Mangler.mangle(D))
return false;
return b;
}
-// CHECK-LP64: call __ZN1AC1ERK1Ai
+// CHECK-LP64: call __ZN1AC1ERKS_i
-// CHECK-LP32: call L__ZN1AC1ERK1Ai
+// CHECK-LP32: call L__ZN1AC1ERKS_i
X d(a, 5, 6);
}
-// CHECK-LP64: call __ZN1XC1ERK1Xiii
-// CHECK-LP64: call __ZN1XC1ERK1Xiii
-// CHECK-LP64: call __ZN1XC1ERK1Xiii
+// CHECK-LP64: call __ZN1XC1ERKS_iii
+// CHECK-LP64: call __ZN1XC1ERKS_iii
+// CHECK-LP64: call __ZN1XC1ERKS_iii
-// CHECK-LP32: call L__ZN1XC1ERK1Xiii
-// CHECK-LP32: call L__ZN1XC1ERK1Xiii
-// CHECK-LP32: call L__ZN1XC1ERK1Xiii
+// CHECK-LP32: call L__ZN1XC1ERKS_iii
+// CHECK-LP32: call L__ZN1XC1ERKS_iii
+// CHECK-LP32: call L__ZN1XC1ERKS_iii
dstY.pr();
}
-// CHECK-LP64: .globl __ZN1XaSERK1X
-// CHECK-LP64: .weak_definition __ZN1XaSERK1X
-// CHECK-LP64: __ZN1XaSERK1X:
-// CHECK-LP64: .globl __ZN1QaSERK1Q
-// CHECK-LP64: .weak_definition __ZN1QaSERK1Q
-// CHECK-LP64: __ZN1QaSERK1Q:
+// CHECK-LP64: .globl __ZN1XaSERKS_
+// CHECK-LP64: .weak_definition __ZN1XaSERKS_
+// CHECK-LP64: __ZN1XaSERKS_:
+// CHECK-LP64: .globl __ZN1QaSERKS_
+// CHECK-LP64: .weak_definition __ZN1QaSERKS_
+// CHECK-LP64: __ZN1QaSERKS_:
-// CHECK-LP32: .globl __ZN1XaSERK1X
-// CHECK-LP32: .weak_definition __ZN1XaSERK1X
-// CHECK-LP32: __ZN1XaSERK1X:
-// CHECK-LP32: .globl __ZN1QaSERK1Q
-// CHECK-LP32: .weak_definition __ZN1QaSERK1Q
-// CHECK-LP32: __ZN1QaSERK1Q:
+// CHECK-LP32: .globl __ZN1XaSERKS_
+// CHECK-LP32: .weak_definition __ZN1XaSERKS_
+// CHECK-LP32: __ZN1XaSERKS_:
+// CHECK-LP32: .globl __ZN1QaSERKS_
+// CHECK-LP32: .weak_definition __ZN1QaSERKS_
+// CHECK-LP32: __ZN1QaSERKS_:
m1.pr();
}
-// CHECK-LP64: .globl __ZN1XC1ERK1X
-// CHECK-LP64: .weak_definition __ZN1XC1ERK1X
-// CHECK-LP64: __ZN1XC1ERK1X:
+// CHECK-LP64: .globl __ZN1XC1ERKS_
+// CHECK-LP64: .weak_definition __ZN1XC1ERKS_
+// CHECK-LP64: __ZN1XC1ERKS_:
-// CHECK-LP32: .globl __ZN1XC1ERK1X
-// CHECK-LP32: .weak_definition __ZN1XC1ERK1X
-// CHECK-LP32: __ZN1XC1ERK1X:
+// CHECK-LP32: .globl __ZN1XC1ERKS_
+// CHECK-LP32: .weak_definition __ZN1XC1ERKS_
+// CHECK-LP32: __ZN1XC1ERKS_:
// CHECK: define void @_Z1fN1A1AENS_1BE(
void f(A::A a, A::B b) { }
+
+struct C {
+ struct D { };
+};
+
+// CHECK: define void @_Z1fN1C1DERS_PS_S1_(
+void f(C::D, C&, C*, C&) { }
void test3() {
T t1, t2;
- // RUN: grep "call void @_ZN1TpsERK1T" %t
+ // RUN: grep "call void @_ZN1TpsERKS_" %t
T result = t1 + t2;
}