Add asserts that the function signature matches the other arguments provide

to CGCall functions.

llvm-svn: 63775
This commit is contained in:
Daniel Dunbar 2009-02-04 21:17:21 +00:00
parent 4cf5f3a7e5
commit a45bdbbb6a
2 changed files with 6 additions and 0 deletions

View File

@ -1167,6 +1167,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
++AI;
}
assert(FI.arg_size() == Args.size() &&
"Mismatch between function signature & arguments.");
CGFunctionInfo::const_arg_iterator info_it = FI.arg_begin();
for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
i != e; ++i, ++info_it) {
@ -1316,6 +1318,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
assert(0 && "Invalid ABI kind for return argument");
}
assert(CallInfo.arg_size() == CallArgs.size() &&
"Mismatch between function signature & arguments.");
CGFunctionInfo::const_arg_iterator info_it = CallInfo.arg_begin();
for (CallArgList::const_iterator I = CallArgs.begin(), E = CallArgs.end();
I != E; ++I, ++info_it) {

View File

@ -76,6 +76,8 @@ namespace CodeGen {
arg_iterator arg_begin() { return Args + 1; }
arg_iterator arg_end() { return Args + 1 + NumArgs; }
unsigned arg_size() const { return NumArgs; }
QualType getReturnType() const { return Args[0].type; }
ABIArgInfo &getReturnInfo() { return Args[0].info; }