[PATCH] D80409: [MS ABI] Add mangled type for template integer argument

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 15:11:58 PDT 2020


zequanwu created this revision.
zequanwu added a reviewer: thakis.
zequanwu added a project: clang.
Herald added a subscriber: cfe-commits.

To differentiate different types of template integer arguments, as MSVC does.

Bug filed here: https://bugs.llvm.org/show_bug.cgi?id=45969 which is caused by missing mangled type for template integer argument.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80409

Files:
  clang/lib/AST/MicrosoftMangle.cpp


Index: clang/lib/AST/MicrosoftMangle.cpp
===================================================================
--- clang/lib/AST/MicrosoftMangle.cpp
+++ clang/lib/AST/MicrosoftMangle.cpp
@@ -1374,7 +1374,9 @@
   // See if this is a constant expression.
   llvm::APSInt Value;
   if (E->isIntegerConstantExpr(Value, Context.getASTContext())) {
-    mangleIntegerLiteral(Value, E->getType()->isBooleanType());
+    QualType T = E->getType();
+    mangleType(T, SourceRange());
+    mangleIntegerLiteral(Value, T->isBooleanType());
     return;
   }
 
@@ -1448,9 +1450,12 @@
     }
     break;
   }
-  case TemplateArgument::Integral:
+  case TemplateArgument::Integral: {
+    QualType T = TA.getIntegralType();
+    mangleType(T, SourceRange());
     mangleIntegerLiteral(TA.getAsIntegral(),
-                         TA.getIntegralType()->isBooleanType());
+                         T->isBooleanType());
+  }
     break;
   case TemplateArgument::NullPtr: {
     QualType T = TA.getNullPtrType();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80409.265609.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200521/cd976383/attachment.bin>


More information about the cfe-commits mailing list