Skip to content

Commit 86337d6

Browse files
committed
[Driver] Add tests for enabled static analyzer checkers.
The driver passes flags to cc1 that enable various checkers based on the target triple. This commit adds tests for these flags on Darwin, Linux, and Windows. This is a test-only change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289685 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d4596ba commit 86337d6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Tests for static analyzer checkers that the driver enables by default based
2+
// on the target triple.
3+
4+
// RUN: %clang -### -target x86_64-apple-darwin10 --analyze %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN %s
5+
6+
// CHECK-DARWIN: "-analyzer-checker=core"
7+
// CHECK-DARWIN-SAME: "-analyzer-checker=unix"
8+
// CHECK-DARWIN-SAME: "-analyzer-checker=osx"
9+
// CHECK-DARWIN-SAME: "-analyzer-checker=deadcode"
10+
// CHECK-DARWIN-SAME: "-analyzer-checker=cplusplus"
11+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.UncheckedReturn"
12+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.getpw"
13+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.gets"
14+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.mktemp"
15+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.mkstemp"
16+
// CHECK-DARWIN-SAME: "-analyzer-checker=security.insecureAPI.vfork"
17+
// CHECK-DARWIN-SAME: "-analyzer-checker=nullability.NullPassedToNonnull"
18+
// CHECK-DARWIN-SAME: "-analyzer-checker=nullability.NullReturnedFromNonnull"
19+
20+
21+
// RUN: %clang -### -target x86_64-unknown-linux --analyze %s 2>&1 | FileCheck --check-prefix=CHECK-LINUX %s
22+
23+
// CHECK-LINUX: "-analyzer-checker=core"
24+
// CHECK-LINUX-SAME: "-analyzer-checker=unix"
25+
// CHECK-LINUX-NOT: "-analyzer-checker=osx"
26+
// CHECK-LINUX-SAME: "-analyzer-checker=deadcode"
27+
// CHECK-LINUX-SAME: "-analyzer-checker=cplusplus"
28+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.UncheckedReturn"
29+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.getpw"
30+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.gets"
31+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.mktemp"
32+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.mkstemp"
33+
// CHECK-LINUX-SAME: "-analyzer-checker=security.insecureAPI.vfork"
34+
// CHECK-LINUX-SAME: "-analyzer-checker=nullability.NullPassedToNonnull"
35+
// CHECK-LINUX-SAME: "-analyzer-checker=nullability.NullReturnedFromNonnull"
36+
37+
38+
// RUN: %clang -### -target x86_64-windows --analyze %s 2>&1 | FileCheck --check-prefix=CHECK-WINDOWS %s
39+
40+
// CHECK-WINDOWS: "-analyzer-checker=core"
41+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.API"
42+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.Malloc"
43+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.MallocSizeof"
44+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.MismatchedDeallocator"
45+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.cstring.BadSizeArg"
46+
// CHECK-WINDOWS-SAME: "-analyzer-checker=unix.cstring.NullArg"
47+
// CHECK-WINDOWS-NOT: "-analyzer-checker=osx"
48+
// CHECK-WINDOWS-SAME: "-analyzer-checker=deadcode"
49+
// CHECK-WINDOWS-SAME: "-analyzer-checker=cplusplus"
50+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.UncheckedReturn"
51+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.getpw"
52+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.gets"
53+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.mktemp"
54+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.mkstemp"
55+
// CHECK-WINDOWS-SAME: "-analyzer-checker=security.insecureAPI.vfork"
56+
// CHECK-WINDOWS-SAME: "-analyzer-checker=nullability.NullPassedToNonnull"
57+
// CHECK-WINDOWS-SAME: "-analyzer-checker=nullability.NullReturnedFromNonnull"

0 commit comments

Comments
 (0)