From c128e70ff2fdb5a72fa958c5c429a3f442a6decc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 12 Jul 2010 18:02:04 +0000 Subject: Add a lint check for mismatched return types, inspired by PR6944. llvm-svn: 108162 --- llvm/lib/Analysis/Lint.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Analysis/Lint.cpp') diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp index 60654e61701..9f1b30d2cf4 100644 --- a/llvm/lib/Analysis/Lint.cpp +++ b/llvm/lib/Analysis/Lint.cpp @@ -225,6 +225,10 @@ void Lint::visitCallSite(CallSite CS) { "Undefined behavior: Call argument count mismatches callee " "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. // TODO: Verify that caller and callee attributes are compatible. Function::arg_iterator PI = F->arg_begin(), PE = F->arg_end(); -- cgit v1.2.3