void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type);
private:
- bool mangleSubstitution(const NamedDecl *ND) {
- return mangleSubstitution(reinterpret_cast<uintptr_t>(ND));
- }
+ bool mangleSubstitution(const NamedDecl *ND);
bool mangleSubstitution(QualType T);
bool mangleSubstitution(uintptr_t Ptr);
// ::= # empty
// ::= <substitution>
// FIXME: We only handle mangling of namespaces and classes at the moment.
+
+ if (mangleSubstitution(cast<NamedDecl>(DC)))
+ return;
+
if (!DC->getParent()->isTranslationUnit())
manglePrefix(DC->getParent());
} else
mangleSourceName(Record->getIdentifier());
}
+
+ addSubstitution(cast<NamedDecl>(DC));
}
void
// <substitution> ::= S <seq-id> _
// ::= S_
+
+bool CXXNameMangler::mangleSubstitution(const NamedDecl *ND) {
+ return mangleSubstitution(reinterpret_cast<uintptr_t>(ND));
+}
+
bool CXXNameMangler::mangleSubstitution(QualType T) {
uintptr_t TypePtr = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
-// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin10 &&
+// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
struct X { };
-// RUN: grep "define void @_Z1fPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP1XS13_S12_S11_S10_SZ_SY_SX_SW_SV_SU_ST_SS_SR_SQ_SP_SO_SN_SM_SL_SK_SJ_SI_SH_SG_SF_SE_SD_SC_SB_SA_S9_S8_S7_S6_S5_S4_S3_S2_S1_S0_S_(" %t &&
+// CHECK: define void @_Z1fPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP1XS13_S12_S11_S10_SZ_SY_SX_SW_SV_SU_ST_SS_SR_SQ_SP_SO_SN_SM_SL_SK_SJ_SI_SH_SG_SF_SE_SD_SC_SB_SA_S9_S8_S7_S6_S5_S4_S3_S2_S1_S0_S_(
void f(X****************************************,
X****************************************,
X***************************************,
X**,
X*,
X) { }
-
-// RUN: true
struct X {};
-// CHECK: define void @_Z1f1XS_
+// CHECK: define void @_Z1f1XS_(
void f(X, X) { }
-// CHECK: define void @_Z1fR1XS0_
+// CHECK: define void @_Z1fR1XS0_(
void f(X&, X&) { }
-// CHECK: define void @_Z1fRK1XS1_
+// CHECK: define void @_Z1fRK1XS1_(
void f(const X&, const X&) { }
typedef void T();
struct S {};
-// CHECK: define void @_Z1fPFvvEM1SFvvE
+// CHECK: define void @_Z1fPFvvEM1SFvvE(
void f(T*, T (S::*)) {}
-// RUN: true
+namespace A {
+ struct A { };
+ struct B { };
+};
+
+// CHECK: define void @_Z1fN1A1AENS_1BE(
+void f(A::A a, A::B b) { }