summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-04-18 23:21:32 +0000
committerReid Kleckner <rnk@google.com>2018-04-18 23:21:32 +0000
commit54a33d7a27516e71b31dc2d0934a40893c53d917 (patch)
treed656615e6f51b17fa1d6f4547fdeda32d9eb0fa4 /clang/lib/CodeGen/CGVTables.cpp
parent47196a25bbec1d56961a1caf3e68410ee6aa93b5 (diff)
downloadbcm5719-llvm-54a33d7a27516e71b31dc2d0934a40893c53d917.tar.gz
bcm5719-llvm-54a33d7a27516e71b31dc2d0934a40893c53d917.zip
[MS] Fix unprototyped thunk emission for incomplete return types
Fixes PR37161 llvm-svn: 330303
Diffstat (limited to 'clang/lib/CodeGen/CGVTables.cpp')
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index d063f036d75..7ac15ba6153 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -233,11 +233,15 @@ void CodeGenFunction::StartThunk(llvm::Function *Fn, GlobalDecl GD,
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
QualType ThisType = MD->getThisType(getContext());
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
- QualType ResultType = CGM.getCXXABI().HasThisReturn(GD)
- ? ThisType
- : CGM.getCXXABI().hasMostDerivedReturn(GD)
- ? CGM.getContext().VoidPtrTy
- : FPT->getReturnType();
+ QualType ResultType;
+ if (IsUnprototyped)
+ ResultType = CGM.getContext().VoidTy;
+ else if (CGM.getCXXABI().HasThisReturn(GD))
+ ResultType = ThisType;
+ else if (CGM.getCXXABI().hasMostDerivedReturn(GD))
+ ResultType = CGM.getContext().VoidPtrTy;
+ else
+ ResultType = FPT->getReturnType();
FunctionArgList FunctionArgs;
// Create the implicit 'this' parameter declaration.
OpenPOWER on IntegriCloud