Fix a crash in the static analyzer (bug #16307)
Summary:
When processing a call to a function, which got passed less arguments than it
expects, the analyzer would crash.
I've also added a test for that and a analyzer warning which detects these
cases.
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D994
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184288 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/inline.c b/test/Analysis/inline.c
index 8cba63f..9ecdce3 100644
--- a/test/Analysis/inline.c
+++ b/test/Analysis/inline.c
@@ -110,3 +110,9 @@
clang_analyzer_checkInlined(0); // no-warning
}
+
+void knr_one_argument(a) int a; { }
+
+void call_with_less_arguments() {
+ knr_one_argument(); // expected-warning{{too few arguments}} expected-warning{{Function taking 1 argument}}
+}