Author: nico Date: Fri Oct 11 05:27:51 2019 New Revision: 374543 URL: http://llvm.org/viewvc/llvm-project?rev=374543&view=rev Log: [MS ABI]: Fix mangling function arguments for template types to be compatible with MSVC
MS name mangling supports cache for first 10 distinct function arguments. The error was when non cached template type occurred twice (e.g. 11th and 12th). For such case in code there is another cache table TemplateArgStrings (for performance reasons). Then one '@' character at the end of the mangled name taken from this table was missing. For other cases the missing '@' character was added in the call to mangleSourceName(TemplateMangling) in the cache miss code, but the cache hit code didn't add it. This fixes a regression from r362560. Patch by Adam Folwarczny <[email protected]>! Differential Revision: https://reviews.llvm.org/D68099 Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/test/CodeGenCXX/mangle-ms-back-references.cpp Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=374543&r1=374542&r2=374543&view=diff ============================================================================== --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Oct 11 05:27:51 2019 @@ -846,7 +846,7 @@ void MicrosoftCXXNameMangler::mangleUnqu TemplateArgStringStorage.save(TemplateMangling.str()); } } else { - Out << Found->second; // Outputs a StringRef. + Out << Found->second << '@'; // Outputs a StringRef. } } else { Out << Found->second; // Outputs a back reference (an int). Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-back-references.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-back-references.cpp?rev=374543&r1=374542&r2=374543&view=diff ============================================================================== --- cfe/trunk/test/CodeGenCXX/mangle-ms-back-references.cpp (original) +++ cfe/trunk/test/CodeGenCXX/mangle-ms-back-references.cpp Fri Oct 11 05:27:51 2019 @@ -66,3 +66,20 @@ namespace foo { void foo() { } // CHECK: "?foo@0@YAXXZ" } + +class T01; +class T02; +class T03; +class T04; +class T05; +class T06; +class T07; +class T08; +class T09; +class T10; +class T11; +template <typename T> +class H; + +void ManyParams(T01 &, T02 &, T03 &, T04 &, T05 &, T06 &, T07 &, T08 &, T09 &, T10 &, H<T11> &, H<T11> &) {} +// CHECK: "?ManyParams@@YAXAAVT01@@AAVT02@@AAVT03@@AAVT04@@AAVT05@@AAVT06@@AAVT07@@AAVT08@@AAVT09@@AAVT10@@AAV?$H@VT11@@@@AAV?$H@VT11@@@@@Z" _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
