[PATCH] D11848: AST: Implement mangling support for function types without a prototype.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 14:43:39 PDT 2015
rsmith added a subscriber: rsmith.
================
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';
----------------
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).
http://reviews.llvm.org/D11848
More information about the cfe-commits
mailing list