diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-07 04:26:04 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-07 04:26:04 +0000 |
commit | 433d1374409a8eeaa4b0975fa187a542d5e40c23 (patch) | |
tree | 52631b6041b44b22fcd1a95bf31365dcbf4411d6 | |
parent | 63c8b77334f90472260d2f48df2742ed5067261e (diff) |
When looking up and adding substitutions to the substitution table, make sure to always use the canonical declaration. With tihs change, FileCheck compiles and links but crashes during startup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86339 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenCXX/mangle-subst.cpp | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 11bbaae018..081156cb6e 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -65,6 +65,8 @@ namespace { bool mangleStandardSubstitution(const NamedDecl *ND); void addSubstitution(const NamedDecl *ND) { + ND = cast<NamedDecl>(ND->getCanonicalDecl()); + addSubstitution(reinterpret_cast<uintptr_t>(ND)); } void addSubstitution(QualType T); @@ -1174,6 +1176,7 @@ bool CXXNameMangler::mangleSubstitution(const NamedDecl *ND) { if (mangleStandardSubstitution(ND)) return true; + ND = cast<NamedDecl>(ND->getCanonicalDecl()); return mangleSubstitution(reinterpret_cast<uintptr_t>(ND)); } diff --git a/test/CodeGenCXX/mangle-subst.cpp b/test/CodeGenCXX/mangle-subst.cpp index 46a21b62b5..a940f4f447 100644 --- a/test/CodeGenCXX/mangle-subst.cpp +++ b/test/CodeGenCXX/mangle-subst.cpp @@ -59,3 +59,11 @@ template void ft3<int>(S1<int>, S1<char>); // CHECK: @_Z1fPKcS0_ void f(const char*, const char*) {} +namespace NS { + class C; +} + +namespace NS { + // CHECK: @_ZN2NS1fERNS_1CE + void f(C&) { } +} |