From: Artem Dergachev Date: Tue, 14 Aug 2018 21:06:30 +0000 (+0000) Subject: [analyzer] Add a test forgotten in r339088. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3463c9ea4607dd986af7d82c905acbb8b2e21f27;p=clang [analyzer] Add a test forgotten in r339088. Differential Revision: https://reviews.llvm.org/D50363 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339726 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/std-c-library-functions-inlined.c b/test/Analysis/std-c-library-functions-inlined.c new file mode 100644 index 0000000000..5277a6efbe --- /dev/null +++ b/test/Analysis/std-c-library-functions-inlined.c @@ -0,0 +1,17 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions -verify %s +// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s +// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s +// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s + +// This test tests crashes that occur when standard functions are available +// for inlining. + +// expected-no-diagnostics + +int isdigit(int _) { return !0; } +void test_redefined_isdigit(int x) { + int (*func)(int) = isdigit; + for (; func(x);) // no-crash + ; +}