[cfe-commits] r159056 - in /cfe/trunk: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/mangle-ms-templates.cpp
Charles Davis
cdavis at mines.edu
Fri Jun 22 17:27:49 PDT 2012
Author: cdavis
Date: Fri Jun 22 19:27:49 2012
New Revision: 159056
URL: http://llvm.org/viewvc/llvm-project?rev=159056&view=rev
Log:
MicrosoftMangle: Fix mangling of integral constant non-type template arguments in a class specialization.
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=159056&r1=159055&r2=159056&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Jun 22 19:27:49 2012
@@ -744,7 +744,16 @@
case TemplateArgument::Integral:
mangleIntegerLiteral(TA.getIntegralType(), TA.getAsIntegral());
break;
- default: {
+ case TemplateArgument::Expression: {
+ // See if this is a constant expression.
+ Expr *TAE = TA.getAsExpr();
+ llvm::APSInt Value;
+ if (TAE->isIntegerConstantExpr(Value, Context.getASTContext())) {
+ mangleIntegerLiteral(TAE->getType(), Value);
+ break;
+ }
+ /* fallthrough */
+ } default: {
// Issue a diagnostic.
DiagnosticsEngine &Diags = Context.getDiags();
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
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=159056&r1=159055&r2=159056&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Fri Jun 22 19:27:49 2012
@@ -23,6 +23,13 @@
IntTemplate() {}
};
+template<>
+class BoolTemplate<true> {
+ public:
+ BoolTemplate() {}
+ template<class T> void Foo(T arg) {}
+};
+
void template_mangling() {
Class<Typename> c1;
c1.method();
@@ -36,7 +43,10 @@
// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$0A@@@QAE at XZ"
BoolTemplate<true> _true;
+ // PR13158
+ _true.Foo(1);
// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE at XZ"
+// CHECK: call {{.*}} @"\01??$Foo at H@?$BoolTemplate@$00@@QAEXH at Z"
IntTemplate<5> five;
// CHECK: call {{.*}} @"\01??0?$IntTemplate@$04@@QAE at XZ"
More information about the cfe-commits
mailing list