summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/std-c-library-functions.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2016-10-24 09:41:38 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2016-10-24 09:41:38 +0000
commitbba497fb65020b172e445cf175ec6789018fa419 (patch)
treea831c6f2140b386898ae442bf57f280667ca04df /clang/test/Analysis/std-c-library-functions.cpp
parentcb642b91363660df0d2ac5d466ffe0a13e10aa66 (diff)
downloadbcm5719-llvm-bba497fb65020b172e445cf175ec6789018fa419.tar.gz
bcm5719-llvm-bba497fb65020b172e445cf175ec6789018fa419.zip
[analyzer] Add StdLibraryFunctions checker.
This checker does not emit reports, however it influences the analysis by providing complete summaries for, or otherwise improving modeling of, various standard library functions. This should reduce the number of infeasible paths explored during analysis. The custom function summary format used in this checker is superior to body farms by causing less unnecessary state splits, which would result in better analysis performance. Differential Revision: https://reviews.llvm.org/D20811 llvm-svn: 284960
Diffstat (limited to 'clang/test/Analysis/std-c-library-functions.cpp')
-rw-r--r--clang/test/Analysis/std-c-library-functions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Analysis/std-c-library-functions.cpp b/clang/test/Analysis/std-c-library-functions.cpp
new file mode 100644
index 00000000000..271fffde692
--- /dev/null
+++ b/clang/test/Analysis/std-c-library-functions.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=unix.StdCLibraryFunctions,debug.ExprInspection -verify %s
+
+// Test that we don't model functions with broken prototypes.
+// Because they probably work differently as well.
+//
+// This test lives in a separate file because we wanted to test all functions
+// in the .c file, however in C there are no overloads.
+
+void clang_analyzer_eval(bool);
+bool isalpha(char);
+
+void test() {
+ clang_analyzer_eval(isalpha('A')); // no-crash // expected-warning{{UNKNOWN}}
+}
OpenPOWER on IntegriCloud