xref: /llvm-project/clang/test/Analysis/invalid-checker-option.c (revision 1ea584377e7897f7df5302ed9cd378d17be14fbf)
1 // RUN: not %clang_analyze_cc1 -verify %s \
2 // RUN:   -analyzer-checker=core \
3 // RUN:   -analyzer-config RetainOneTwoThree:CheckOSObject=false \
4 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER
5 
6 // Note that non-existent packages and checkers were always reported.
7 
8 // RUN: not %clang_analyze_cc1 -verify %s \
9 // RUN:   -analyzer-checker=core \
10 // RUN:   -analyzer-config-compatibility-mode=true \
11 // RUN:   -analyzer-config RetainOneTwoThree:CheckOSObject=false \
12 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER
13 
14 // CHECK-NON-EXISTENT-CHECKER: (frontend): no analyzer checkers or packages
15 // CHECK-NON-EXISTENT-CHECKER-SAME: are associated with 'RetainOneTwoThree'
16 
17 
18 // RUN: %clang_analyze_cc1 -verify %s \
19 // RUN:   -analyzer-checker=core \
20 // RUN:   -analyzer-checker=debug.ConfigDumper \
21 // RUN:   -analyzer-checker=debug.AnalysisOrder \
22 // RUN:   -analyzer-config-compatibility-mode=true \
23 // RUN:   -analyzer-config debug.AnalysisOrder:*=yesplease \
24 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-BOOL-VALUE
25 
26 // CHECK-CORRECTED-BOOL-VALUE: debug.AnalysisOrder:* = false
27 //
28 // RUN: %clang_analyze_cc1 -verify %s \
29 // RUN:   -analyzer-checker=core \
30 // RUN:   -analyzer-checker=debug.ConfigDumper \
31 // RUN:   -analyzer-checker=optin.performance.Padding \
32 // RUN:   -analyzer-config-compatibility-mode=true \
33 // RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme \
34 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-INT-VALUE
35 
36 // CHECK-CORRECTED-INT-VALUE: optin.performance.Padding:AllowedPad = 24
37 
38 
39 // Every other error should be avoidable in compatiblity mode.
40 
41 
42 // RUN: not %clang_analyze_cc1 -verify %s \
43 // RUN:   -analyzer-checker=core \
44 // RUN:   -analyzer-config debug.AnalysisOrder:Everything=false \
45 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER-OPTION
46 
47 // CHECK-NON-EXISTENT-CHECKER-OPTION: (frontend): checker 'debug.AnalysisOrder'
48 // CHECK-NON-EXISTENT-CHECKER-OPTION-SAME: has no option called 'Everything'
49 
50 // RUN: %clang_analyze_cc1 -verify %s \
51 // RUN:   -analyzer-checker=core \
52 // RUN:   -analyzer-config-compatibility-mode=true \
53 // RUN:   -analyzer-config debug.AnalysisOrder:Everything=false
54 
55 
56 // RUN: not %clang_analyze_cc1 -verify %s \
57 // RUN:   -analyzer-checker=core \
58 // RUN:   -analyzer-config debug.AnalysisOrder:*=nothankyou \
59 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-BOOL-VALUE
60 
61 // CHECK-INVALID-BOOL-VALUE: (frontend): invalid input for checker option
62 // CHECK-INVALID-BOOL-VALUE-SAME: 'debug.AnalysisOrder:*', that expects a
63 // CHECK-INVALID-BOOL-VALUE-SAME: boolean value
64 
65 // RUN: %clang_analyze_cc1 -verify %s \
66 // RUN:   -analyzer-checker=core \
67 // RUN:   -analyzer-config-compatibility-mode=true \
68 // RUN:   -analyzer-config debug.AnalysisOrder:*=nothankyou
69 
70 
71 // RUN: not %clang_analyze_cc1 -verify %s \
72 // RUN:   -analyzer-checker=core \
73 // RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme \
74 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-INT-VALUE
75 
76 // CHECK-INVALID-INT-VALUE: (frontend): invalid input for checker option
77 // CHECK-INVALID-INT-VALUE-SAME: 'optin.performance.Padding:AllowedPad', that
78 // CHECK-INVALID-INT-VALUE-SAME: expects an integer value
79 
80 // RUN: %clang_analyze_cc1 -verify %s \
81 // RUN:   -analyzer-checker=core \
82 // RUN:   -analyzer-config-compatibility-mode=true \
83 // RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme
84 
85 
86 // RUN: not %clang_analyze_cc1 -verify %s \
87 // RUN:   -analyzer-checker=core \
88 // RUN:   -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=sure \
89 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-PACKAGE-VALUE
90 
91 // CHECK-PACKAGE-VALUE: (frontend): invalid input for checker option
92 // CHECK-PACKAGE-VALUE-SAME: 'nullability:NoDiagnoseCallsToSystemHeaders', that
93 // CHECK-PACKAGE-VALUE-SAME: expects a boolean value
94 
95 // expected-no-diagnostics
96 
main(void)97 int main(void) {}
98