mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 18:29:45 +00:00
Add a lint check for mismatched return types, inspired by PR6944.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
81ea00f45d
commit
545d00645c
@ -225,6 +225,10 @@ void Lint::visitCallSite(CallSite CS) {
|
|||||||
"Undefined behavior: Call argument count mismatches callee "
|
"Undefined behavior: Call argument count mismatches callee "
|
||||||
"argument count", &I);
|
"argument count", &I);
|
||||||
|
|
||||||
|
Assert1(FT->getReturnType() == I.getType(),
|
||||||
|
"Undefined behavior: Call return type mismatches "
|
||||||
|
"callee return type", &I);
|
||||||
|
|
||||||
// Check argument types (in case the callee was casted) and attributes.
|
// Check argument types (in case the callee was casted) and attributes.
|
||||||
// TODO: Verify that caller and callee attributes are compatible.
|
// TODO: Verify that caller and callee attributes are compatible.
|
||||||
Function::arg_iterator PI = F->arg_begin(), PE = F->arg_end();
|
Function::arg_iterator PI = F->arg_begin(), PE = F->arg_end();
|
||||||
|
@ -154,3 +154,12 @@ exit:
|
|||||||
%x = volatile load i32* %t3
|
%x = volatile load i32* %t3
|
||||||
br label %exit
|
br label %exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; CHECK: Call return type mismatches callee return type
|
||||||
|
%struct = type { double, double }
|
||||||
|
declare i32 @nonstruct_callee() nounwind
|
||||||
|
define void @struct_caller() nounwind {
|
||||||
|
entry:
|
||||||
|
call %struct bitcast (i32 ()* @foo to %struct ()*)()
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user