Am I right in thinking this patch depends on your other patch to keep the 
type before parameter decay as the TypeSourceInfo of a FunctionDecl?


================
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>();
----------------
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.

================
Comment at: lib/AST/MicrosoftMangle.cpp:1217-1225
@@ -1210,11 +1216,11 @@
     if (D) {
-      // If we got a decl, use the type-as-written to make sure arrays
-      // get mangled right.  Note that we can't rely on the TSI
-      // existing if (for example) the parameter was synthesized.
+      // If we got a decl, use it to get the source range.  This used to be
+      // important for getting the type-as-written.  We've since changed to
+      // traversing the type-as-written, so this shouldn't be necessary 
anymore.
       for (FunctionDecl::param_const_iterator Parm = D->param_begin(),
              ParmEnd = D->param_end(); Parm != ParmEnd; ++Parm) {
         TypeSourceInfo *TSI = (*Parm)->getTypeSourceInfo();
         QualType Type = TSI ? TSI->getType() : (*Parm)->getType();
         mangleArgumentType(Type, (*Parm)->getSourceRange());
       }
     } else {
----------------
Can you just use the parameter types from the FunctionProtoType here?


http://llvm-reviews.chandlerc.com/D844
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to