diff options
author | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-02-11 11:26:03 +0000 |
---|---|---|
committer | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-02-11 11:26:03 +0000 |
commit | 380b2243595046d472884f7902f6f76749306508 (patch) | |
tree | 392a7a9cac46bdf5789557c1548d98af395a381b /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 44e7c51b0522eff235b9aca3c004277a98ee805d (diff) | |
download | bcm5719-llvm-380b2243595046d472884f7902f6f76749306508.tar.gz bcm5719-llvm-380b2243595046d472884f7902f6f76749306508.zip |
[MCU] Fix assertion failure on function returning empty union.
Treat empty struct/union in return type as void for MCU ABI. PR26438.
Differential Revision: http://reviews.llvm.org/D16808
llvm-svn: 260510
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 1cfdde38a36..bbc6b3b1ae2 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -364,7 +364,7 @@ static bool isEmptyField(ASTContext &Context, const FieldDecl *FD, static bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays) { const RecordType *RT = T->getAs<RecordType>(); if (!RT) - return 0; + return false; const RecordDecl *RD = RT->getDecl(); if (RD->hasFlexibleArrayMember()) return false; @@ -1119,6 +1119,10 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, if (!IsRetSmallStructInRegABI && !RetTy->isAnyComplexType()) return getIndirectReturnResult(RetTy, State); + // Ignore empty structs/unions. + if (isEmptyRecord(getContext(), RetTy, true)) + return ABIArgInfo::getIgnore(); + // Small structures which are register sized are generally returned // in a register. if (shouldReturnTypeInRegister(RetTy, getContext())) { |