[LLVMdev] Switching to the new MingW ABI

Reid Kleckner rnk at google.com
Tue Dec 10 15:57:09 PST 2013


On Tue, Dec 10, 2013 at 11:58 AM, Hans Wennborg <hans at chromium.org> wrote:

> It would be nice if we could make the TypePrinter not print the
> calling convention if it's the default one for the ABI, but
> TypePrinter doesn't have a lot of context.. no Sema, no ASTContext :/
>

Does this patch fix any failures for you?  It doesn't fix that test case,
unfortunately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131210/ffd7b891/attachment.html>
-------------- next part --------------
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 082d027..cdfc90b 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -399,10 +399,16 @@ void TypePrinter::printMemberPointerBefore(const MemberPointerType *T,
                                            raw_ostream &OS) { 
   IncludeStrongLifetimeRAII Strong(Policy);
   SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
-  printBefore(T->getPointeeType(), OS);
+
+  // Suppress the printing of implied calling conventions.
+  QualType Pointee = T->getPointeeType();
+  if (const AdjustedType *AT = dyn_cast<AdjustedType>(Pointee))
+    Pointee = AT->getOriginalType();
+
+  printBefore(Pointee, OS);
   // Handle things like 'int (Cls::*A)[4];' correctly.
   // FIXME: this should include vectors, but vectors use attributes I guess.
-  if (isa<ArrayType>(T->getPointeeType()))
+  if (isa<ArrayType>(Pointee))
     OS << '(';
 
   PrintingPolicy InnerPolicy(Policy);
@@ -415,11 +421,17 @@ void TypePrinter::printMemberPointerAfter(const MemberPointerType *T,
                                           raw_ostream &OS) { 
   IncludeStrongLifetimeRAII Strong(Policy);
   SaveAndRestore<bool> NonEmptyPH(HasEmptyPlaceHolder, false);
+
+  // Suppress the printing of implied calling conventions.
+  QualType Pointee = T->getPointeeType();
+  if (const AdjustedType *AT = dyn_cast<AdjustedType>(Pointee))
+    Pointee = AT->getOriginalType();
+
   // Handle things like 'int (Cls::*A)[4];' correctly.
   // FIXME: this should include vectors, but vectors use attributes I guess.
-  if (isa<ArrayType>(T->getPointeeType()))
+  if (isa<ArrayType>(Pointee))
     OS << ')';
-  printAfter(T->getPointeeType(), OS);
+  printAfter(Pointee, OS);
 }
 
 void TypePrinter::printConstantArrayBefore(const ConstantArrayType *T, 


More information about the llvm-dev mailing list