1 // RUN: not %clang_analyze_cc1 -verify %s \
2 // RUN:   -analyzer-checker=core \
3 // RUN:   -analyzer-config notes-as-events=yesplease \
4 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-BOOL-INPUT
5 
6 // CHECK-BOOL-INPUT: (frontend): invalid input for analyzer-config option
7 // CHECK-BOOL-INPUT-SAME:        'notes-as-events', that expects a boolean value
8 
9 // RUN: %clang_analyze_cc1 -verify %s \
10 // RUN:   -analyzer-checker=core \
11 // RUN:   -analyzer-config-compatibility-mode=true \
12 // RUN:   -analyzer-config notes-as-events=yesplease
13 
14 
15 // RUN: not %clang_analyze_cc1 -verify %s \
16 // RUN:   -analyzer-checker=core \
17 // RUN:   -analyzer-config max-inlinable-size=400km/h \
18 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-UINT-INPUT
19 
20 // CHECK-UINT-INPUT: (frontend): invalid input for analyzer-config option
21 // CHECK-UINT-INPUT-SAME:        'max-inlinable-size', that expects an unsigned
22 // CHECK-UINT-INPUT-SAME:        value
23 
24 // RUN: %clang_analyze_cc1 -verify %s \
25 // RUN:   -analyzer-checker=core \
26 // RUN:   -analyzer-config-compatibility-mode=true \
27 // RUN:   -analyzer-config max-inlinable-size=400km/h
28 
29 
30 // RUN: not %clang_analyze_cc1 -verify %s \
31 // RUN:   -analyzer-checker=core \
32 // RUN:   -analyzer-config ctu-dir=0123012301230123 \
33 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-FILENAME-INPUT
34 
35 // CHECK-FILENAME-INPUT: (frontend): invalid input for analyzer-config option
36 // CHECK-FILENAME-INPUT-SAME:        'ctu-dir', that expects a filename
37 // CHECK-FILENAME-INPUT-SAME:        value
38 
39 // RUN: %clang_analyze_cc1 -verify %s \
40 // RUN:   -analyzer-checker=core \
41 // RUN:   -analyzer-config-compatibility-mode=true \
42 // RUN:   -analyzer-config ctu-dir=0123012301230123
43 
44 
45 // RUN: not %clang_analyze_cc1 -verify %s \
46 // RUN:   -analyzer-checker=core \
47 // RUN:   -analyzer-config no-false-positives=true \
48 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-CFG
49 
50 // CHECK-UNKNOWN-CFG: (frontend): unknown analyzer-config 'no-false-positives'
51 
52 // RUN: %clang_analyze_cc1 -verify %s \
53 // RUN:   -analyzer-checker=core \
54 // RUN:   -analyzer-config-compatibility-mode=true \
55 // RUN:   -analyzer-config no-false-positives=true
56 
57 
58 // Test the driver properly using "analyzer-config-compatibility-mode=true",
59 // no longer causing an error on input error.
60 // RUN: %clang --analyze %s
61 
62 // RUN: not %clang --analyze %s \
63 // RUN:   -Xclang -analyzer-config -Xclang no-false-positives=true \
64 // RUN:   -Xclang -analyzer-config-compatibility-mode=false \
65 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NO-COMPAT
66 
67 // CHECK-NO-COMPAT: error: unknown analyzer-config 'no-false-positives'
68 
69 // Test the driver properly using "analyzer-config-compatibility-mode=true",
70 // even if -analyze isn't specified.
71 // RUN: %clang -fsyntax-only -Xclang -analyzer-config\
72 // RUN:                      -Xclang remember=TheVasa %s
73 // RUN: %clang -fsyntax-only -Xanalyzer -analyzer-config\
74 // RUN:                      -Xanalyzer remember=TheVasa %s
75 // RUN: %clang --analyze -Xanalyzer -analyzer-config\
76 // RUN:                  -Xanalyzer remember=TheVasa %s
77 
78 // expected-no-diagnostics
79 
main()80 int main() {}
81