[PATCH] [ms-cxxabi] Mangle function pointer arguments correctly

Peter Collingbourne peter at pcc.me.uk
Mon Jun 3 11:44:00 PDT 2013



================
Comment at: lib/AST/MicrosoftMangle.cpp:263-264
@@ -262,2 +262,4 @@
   // We don't even know how to mangle their types anyway :).
-  const FunctionProtoType *FT = FD->getType()->castAs<FunctionProtoType>();
+  TypeSourceInfo *TSI = FD->getTypeSourceInfo();
+  QualType T = TSI ? TSI->getType() : FD->getType();
+  const FunctionProtoType *FT = T->castAs<FunctionProtoType>();
----------------
Richard Smith wrote:
> Which declaration is 'FD' here? If I have this in a header:
> 
>   void f(int p[123]);
> 
> ... and this in my source file:
> 
>   #include "header"
>   void f(int *const p) {}
> 
> ... then do we use the mangling for the header's declaration or for the source file's declaration? I would guess (or rather, hope) that we use the mangling for the first declaration of the function.
ITYM

  void f(int *p) {}

i.e. a redeclaration of f with a different mangling (the const qualified version would have the same mangling).


http://llvm-reviews.chandlerc.com/D844



More information about the cfe-commits mailing list