diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-08-07 23:25:47 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-08-07 23:25:47 +0000 |
commit | eeebc41b580cc5d77f22da312a8d413f96c63edd (patch) | |
tree | 2cf6d3f55f6887db3d90567788f2d51f4b547bfb /clang/lib/AST/ItaniumMangle.cpp | |
parent | 0f51d1495738f0d30a3fc1d3fb1226c84c329ec5 (diff) | |
download | bcm5719-llvm-eeebc41b580cc5d77f22da312a8d413f96c63edd.tar.gz bcm5719-llvm-eeebc41b580cc5d77f22da312a8d413f96c63edd.zip |
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
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index e51aad9ad83..1fcf466a1f6 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2055,9 +2055,23 @@ void CXXNameMangler::mangleType(const FunctionProtoType *T) { 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. |