AST: Implement mangling support for function types without a prototype.
Function types without prototypes can arise when mangling a function type
within an overloadable function in C. We mangle these as the absence of
any parameter types (not even an empty parameter list).
Differential Revision: http://reviews.llvm.org/D11848
llvm-svn: 244374
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index e51aad9..1fcf466 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -2055,9 +2055,23 @@
Out << 'E';
}
+
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 the absence of any
+ // parameter types (not even an empty parameter list).
+ Out << 'F';
+
+ FunctionTypeDepthState saved = FunctionTypeDepth.push();
+
+ FunctionTypeDepth.enterResultType();
+ mangleType(T->getReturnType());
+ FunctionTypeDepth.leaveResultType();
+
+ FunctionTypeDepth.pop(saved);
+ Out << 'E';
}
+
void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
bool MangleReturnType) {
// We should never be mangling something without a prototype.