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