diff options
| author | Reid Kleckner <reid@kleckner.net> | 2014-06-10 20:06:25 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2014-06-10 20:06:25 +0000 |
| commit | b4848e7bab685d0e15f4f7fe4382f8ced213d4a8 (patch) | |
| tree | eefbbd696c037890e80b0e4a5b5ce1705e9a886d | |
| parent | 6042506b5c2ccfab5843d3bdef6f0d3adb87a5d3 (diff) | |
| download | bcm5719-llvm-b4848e7bab685d0e15f4f7fe4382f8ced213d4a8.tar.gz bcm5719-llvm-b4848e7bab685d0e15f4f7fe4382f8ced213d4a8.zip | |
Fix mangling of __uuidof after two levels of template instantiation
llvm-svn: 210570
| -rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 3 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/mangle-ms-templates.cpp | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 22d4f343a10..a02402580d9 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -1063,6 +1063,9 @@ void MicrosoftCXXNameMangler::mangleExpression(const Expr *E) { return; } + // Look through no-op casts like template parameter substitutions. + E = E->IgnoreParenNoopCasts(Context.getASTContext()); + const CXXUuidofExpr *UE = nullptr; if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(E)) { if (UO->getOpcode() == UO_AddrOf) diff --git a/clang/test/CodeGenCXX/mangle-ms-templates.cpp b/clang/test/CodeGenCXX/mangle-ms-templates.cpp index 24e4f4abb87..31fda2046c4 100644 --- a/clang/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/clang/test/CodeGenCXX/mangle-ms-templates.cpp @@ -262,3 +262,17 @@ void CallFunctionDefinedWithInjectedName() { FunctionDefinedWithInjectedName(TypeWithFriendDefinition<int>()); } // CHECK: @"\01?FunctionDefinedWithInjectedName@@YAXU?$TypeWithFriendDefinition@H@@@Z" + +// We need to be able to feed GUIDs through a couple rounds of template +// substitution. +template <const _GUID *G> +struct UUIDType3 { + void foo() {} +}; +template <const _GUID *G> +struct UUIDType4 : UUIDType3<G> { + void bar() { UUIDType4::foo(); } +}; +template struct UUIDType4<&__uuidof(uuid)>; +// CHECK: "\01?bar@?$UUIDType4@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ" +// CHECK: "\01?foo@?$UUIDType3@$1?_GUID_12345678_1234_1234_1234_1234567890ab@@3U__s_GUID@@B@@QAEXXZ" |

