diff options
author | John McCall <rjmccall@apple.com> | 2011-03-09 07:12:35 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-03-09 07:12:35 +0000 |
commit | 311b442a5050048e7d498e5ed352a9204b9a3c24 (patch) | |
tree | 9e53f2876a6dc172d68669c472770386e82f43cc /lib/CodeGen/CGVTables.cpp | |
parent | f25330bd88f921b6e4cae965932681f213d9d544 (diff) |
Tame this assert, hopefully fixing self-host.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
-rw-r--r-- | lib/CodeGen/CGVTables.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp index 3a3e6cf234..47f421d3f6 100644 --- a/lib/CodeGen/CGVTables.cpp +++ b/lib/CodeGen/CGVTables.cpp @@ -2559,6 +2559,16 @@ static void setThunkVisibility(CodeGenModule &CGM, const CXXMethodDecl *MD, Fn->setVisibility(llvm::GlobalValue::HiddenVisibility); } +#ifndef NDEBUG +static bool similar(const ABIArgInfo &infoL, CanQualType typeL, + const ABIArgInfo &infoR, CanQualType typeR) { + return (infoL.getKind() == infoR.getKind() && + (typeL == typeR || + (isa<PointerType>(typeL) && isa<PointerType>(typeR)) || + (isa<ReferenceType>(typeL) && isa<ReferenceType>(typeR)))); +} +#endif + void CodeGenFunction::GenerateThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk) { @@ -2619,7 +2629,16 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, #ifndef NDEBUG const CGFunctionInfo &CallFnInfo = CGM.getTypes().getFunctionInfo(ResultType, CallArgs, FPT->getExtInfo()); - assert(&CallFnInfo == &FnInfo && "thunk has different CC from callee?"); + assert(CallFnInfo.getRegParm() == FnInfo.getRegParm() && + CallFnInfo.isNoReturn() == FnInfo.isNoReturn() && + CallFnInfo.getCallingConvention() == FnInfo.getCallingConvention()); + assert(similar(CallFnInfo.getReturnInfo(), CallFnInfo.getReturnType(), + FnInfo.getReturnInfo(), FnInfo.getReturnType())); + assert(CallFnInfo.arg_size() == FnInfo.arg_size()); + for (unsigned i = 0, e = FnInfo.arg_size(); i != e; ++i) + assert(similar(CallFnInfo.arg_begin()[i].info, + CallFnInfo.arg_begin()[i].type, + FnInfo.arg_begin()[i].info, FnInfo.arg_begin()[i].type)); #endif // Determine whether we have a return value slot to use. |