Debian Codegraph @

clang/test/Frontend/verify-mulptiple-prefixes.c

raw
1 // Test the diagnostic messages of -verify with multiple prefixes.
2 // - Expected but not seen errors should contain the prefix of the directive
3 // - Seen but not expected errors should not choose an arbitrary prefix
4 // - "expected directive cannot follow '<prefix>-no-diagnostics'" should report an actual
5 // expected-no-diagnostics prefix present in the source.
6
7 // RUN: not %clang_cc1 -verify=foo,bar %s 2>&1 | FileCheck %s --check-prefix=CHECK1
8 // RUN: not %clang_cc1 -verify=bar,foo %s 2>&1 | FileCheck %s --check-prefix=CHECK1
9
10 undefined_type x; // #1
11
12 // foo-error{{there is no error here}}
13 // bar-error{{error not seen}}
14 // bar-note{{declared here}}
15 // bar-error{{another error not seen}}
16 // bar-error-re{{regex error{{}} not present}}
17
18 // CHECK1: error: diagnostics with 'error' severity expected but not seen:
19 // CHECK1: Line 12 'foo-error': there is no error here
20 // CHECK1: Line 13 'bar-error': error not seen
21 // CHECK1: Line 15 'bar-error': another error not seen
22 // CHECK1: Line 16 'bar-error-re': regex error{{{{[}][}]}} not present
23 // CHECK1: error: diagnostics with 'error' severity seen but not expected:
24 // CHECK1: Line 10: unknown type name 'undefined_type'
25 // CHECK1: error: diagnostics with 'note' severity expected but not seen:
26 // CHECK1: Line 14 'bar-note': declared here
27 // CHECK1: 6 errors generated.
28
29 // RUN: not %clang_cc1 -verify=baz,qux,quux %s 2>&1 | FileCheck %s --check-prefix=CHECK2
30
31 // qux-no-diagnostics
32 // baz-error@#1{{unknown type name 'undefined_type'}}
33 // quux-no-diagnostics
34 // qux-error-re@#1{{unknown type name 'undefined_type'}}
35
36 // CHECK2: error: diagnostics with 'error' severity seen but not expected:
37 // CHECK2: Line 10: unknown type name 'undefined_type'
38 // CHECK2: Line 32: 'baz-error' directive cannot follow 'qux-no-diagnostics' directive
39 // CHECK2: Line 34: 'qux-error-re' directive cannot follow 'qux-no-diagnostics' directive
40
41 // RUN: not %clang_cc1 -verify=spam,eggs %s 2>&1 | FileCheck %s --check-prefix=CHECK3
42
43 // eggs-error@#1{{unknown type name 'undefined_type'}}
44 // spam-no-diagnostics
45
46 // CHECK3: error: diagnostics with 'error' severity seen but not expected:
47 // CHECK3: Line 44: 'spam-no-diagnostics' directive cannot follow other expected directives
48 // CHECK3: 1 error generated.