rsmith added inline comments.

================
Comment at: lib/AST/ItaniumMangle.cpp:2060-2062
@@ -2058,2 +2059,5 @@
 void CXXNameMangler::mangleType(const FunctionNoProtoType *T) {
-  llvm_unreachable("Can't mangle K&R function prototypes");
+  // Function types without prototypes can arise when mangling a function type
+  // within an overloadable function in C. We mangle these as we do a function
+  // with an empty variadic argument list in C++.
+  Out << 'F';
----------------
pcc wrote:
> rsmith wrote:
> > This seems like a suboptimal mangling; a no-prototype function type is not 
> > compatible with a varargs function type, and in particular may have a 
> > different calling convention across a C/C++ ABI boundary. How about instead 
> > mangling this as the absence of any parameter types? (That is, drop the 
> > `z`, and mangle your testcase below as just `_Z1fPFvzE`.) libc++abi already 
> > demangles that as desired (but libstdc++ considers it an invalid mangled 
> > name).
> Do you mean `_Z1fPFvE`? Sounds reasonable to me. I guess on the MS side we 
> can use `@` instead of `Z` to create the distinction there.
Er, yes, thanks :)


http://reviews.llvm.org/D11848



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to