From: Timur Iskhodzhanov Date: Thu, 29 Nov 2012 08:58:47 +0000 (+0000) Subject: [-cxx-abi microsoft] Also spill the argument-back-references context when mangling... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53c61c5c0c912b5032882471f5215d66a11bb0ce;p=clang [-cxx-abi microsoft] Also spill the argument-back-references context when mangling templates git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168862 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index d91f512538..afb8bf8844 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -742,13 +742,17 @@ void MicrosoftCXXNameMangler::mangleTemplateInstantiationName( // Always start with the unqualified name. // Templates have their own context for back references. - BackRefMap TemplateContext; - NameBackReferences.swap(TemplateContext); + ArgBackRefMap OuterArgsContext; + BackRefMap OuterTemplateContext; + NameBackReferences.swap(OuterTemplateContext); + TypeBackReferences.swap(OuterArgsContext); mangleUnscopedTemplateName(TD); mangleTemplateArgs(TemplateArgs); - NameBackReferences.swap(TemplateContext); + // Restore the previous back reference contexts. + NameBackReferences.swap(OuterTemplateContext); + TypeBackReferences.swap(OuterArgsContext); } void diff --git a/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp index 1fa59ab54b..fbc6492348 100644 --- a/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp +++ b/test/CodeGenCXX/mangle-ms-back-references-pr13207.cpp @@ -13,6 +13,8 @@ void foo_abb(A, B >) {} // CHECK: "\01?foo_abb@@YAXV?$A@DV?$B@D@@V1@@@@Z" void foo_abc(A, C >) {} // CHECK: "\01?foo_abc@@YAXV?$A@DV?$B@D@@V?$C@D@@@@@Z" +void foo_bt(bool a, B b) {} +// CHECK: "\01?foo_bt@@YAX_NV?$B@$$A6A_N_N@Z@@@Z" namespace N { template