r179093 - [ms-cxxabi] Add "$$C" when mangling template arg QualTypes
Reid Kleckner
reid at kleckner.net
Tue Apr 9 05:47:38 PDT 2013
Author: rnk
Date: Tue Apr 9 07:47:38 2013
New Revision: 179093
URL: http://llvm.org/viewvc/llvm-project?rev=179093&view=rev
Log:
[ms-cxxabi] Add "$$C" when mangling template arg QualTypes
Credit goes to Timur Iskhodzhanov for finding the problem and solution.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=179093&r1=179092&r2=179093&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Apr 9 07:47:38 2013
@@ -824,9 +824,13 @@ MicrosoftCXXNameMangler::mangleTemplateA
switch (TA.getKind()) {
case TemplateArgument::Null:
llvm_unreachable("Can't mangle null template arguments!");
- case TemplateArgument::Type:
- mangleType(TA.getAsType(), SourceRange());
+ case TemplateArgument::Type: {
+ QualType T = TA.getAsType();
+ if (T.hasQualifiers())
+ Out << "$$C";
+ mangleType(T, SourceRange());
break;
+ }
case TemplateArgument::Declaration:
mangle(cast<NamedDecl>(TA.getAsDecl()), "$1?");
break;
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=179093&r1=179092&r2=179093&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Tue Apr 9 07:47:38 2013
@@ -35,6 +35,18 @@ void template_mangling() {
c1.method();
// CHECK: call {{.*}} @"\01?method@?$Class at VTypename@@@@QAEXXZ"
+ Class<const Typename> c1_const;
+ Class<volatile Typename> c1_volatile;
+ Class<const volatile Typename> c1_cv;
+ c1_const.method();
+ c1_volatile.method();
+ c1_cv.method();
+// Types with qualifiers have an extra $$C escape when used as template
+// arguments. Not sure why.
+// CHECK: call {{.*}} @"\01?method@?$Class@$$CBVTypename@@@@QAEXXZ"
+// CHECK: call {{.*}} @"\01?method@?$Class@$$CCVTypename@@@@QAEXXZ"
+// CHECK: call {{.*}} @"\01?method@?$Class@$$CDVTypename@@@@QAEXXZ"
+
Class<Nested<Typename> > c2;
c2.method();
// CHECK: call {{.*}} @"\01?method@?$Class at V?$Nested at VTypename@@@@@@QAEXXZ"
More information about the cfe-commits
mailing list