summaryrefslogtreecommitdiffstats
path: root/test/Analysis/invalid-analyzer-config-value.c
blob: 34a73a7f9d02f2aa10a95eec7da1210e654da432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// RUN: not %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config notes-as-events=yesplease \
// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-BOOL-INPUT

// CHECK-BOOL-INPUT: (frontend): invalid input for analyzer-config option
// CHECK-BOOL-INPUT-SAME:        'notes-as-events', that expects a boolean value

// RUN: %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config-compatibility-mode=true \
// RUN:   -analyzer-config notes-as-events=yesplease


// RUN: not %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config max-inlinable-size=400km/h \
// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-UINT-INPUT

// CHECK-UINT-INPUT: (frontend): invalid input for analyzer-config option
// CHECK-UINT-INPUT-SAME:        'max-inlinable-size', that expects an unsigned
// CHECK-UINT-INPUT-SAME:        value

// RUN: %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config-compatibility-mode=true \
// RUN:   -analyzer-config max-inlinable-size=400km/h


// RUN: not %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config ctu-dir=0123012301230123 \
// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-FILENAME-INPUT

// CHECK-FILENAME-INPUT: (frontend): invalid input for analyzer-config option
// CHECK-FILENAME-INPUT-SAME:        'ctu-dir', that expects a filename
// CHECK-FILENAME-INPUT-SAME:        value

// RUN: %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config-compatibility-mode=true \
// RUN:   -analyzer-config ctu-dir=0123012301230123


// RUN: not %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config no-false-positives=true \
// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-UNKNOWN-CFG

// CHECK-UNKNOWN-CFG: (frontend): unknown analyzer-config 'no-false-positives'

// RUN: %clang_analyze_cc1 -verify %s \
// RUN:   -analyzer-checker=core \
// RUN:   -analyzer-config-compatibility-mode=true \
// RUN:   -analyzer-config no-false-positives=true


// Test the driver properly using "analyzer-config-compatibility-mode=true",
// no longer causing an error on input error.
// RUN: %clang --analyze %s

// RUN: not %clang --analyze %s \
// RUN:   -Xclang -analyzer-config -Xclang no-false-positives=true \
// RUN:   -Xclang -analyzer-config-compatibility-mode=false \
// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NO-COMPAT

// CHECK-NO-COMPAT: error: unknown analyzer-config 'no-false-positives'

// expected-no-diagnostics

int main() {}