summaryrefslogtreecommitdiff
path: root/lib/Analysis/Lint.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-12 18:02:04 +0000
committerDan Gohman <gohman@apple.com>2010-07-12 18:02:04 +0000
commit545d00645c224e3734a11a6b9b95c8f153de1d8d (patch)
tree160fed2c8a397763c6bc53c22a60baff369cae50 /lib/Analysis/Lint.cpp
parent81ea00f45d59953d34a1db4973dd72d14080ab15 (diff)
downloadllvm-545d00645c224e3734a11a6b9b95c8f153de1d8d.tar.gz
llvm-545d00645c224e3734a11a6b9b95c8f153de1d8d.tar.bz2
llvm-545d00645c224e3734a11a6b9b95c8f153de1d8d.tar.xz
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
Diffstat (limited to 'lib/Analysis/Lint.cpp')
-rw-r--r--lib/Analysis/Lint.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp
index 60654e6170..9f1b30d2cf 100644
--- a/lib/Analysis/Lint.cpp
+++ b/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();