diff options
| author | Andy Gibbs <andyg1001@hotmail.co.uk> | 2014-07-10 16:43:29 +0000 |
|---|---|---|
| committer | Andy Gibbs <andyg1001@hotmail.co.uk> | 2014-07-10 16:43:29 +0000 |
| commit | c1f152ee6c5163cd19a4f695bbb4321da2a0149b (patch) | |
| tree | c23601cf7fbe24fb9eeecbf30b3c256d2d8c96cd /clang/test | |
| parent | f4eba98853dbb8fa1adbd29a2e697f94818c5a7a (diff) | |
| download | bcm5719-llvm-c1f152ee6c5163cd19a4f695bbb4321da2a0149b.tar.gz bcm5719-llvm-c1f152ee6c5163cd19a4f695bbb4321da2a0149b.zip | |
Provide -verify support to match "any" line for diagnostics in included files.
Allow diagnostic checks that originate in included files to be matched without necessarily determining the line number that the diagnostic occurs on. The new syntax replaces the line number with '*'. This extension is limited to diagnostics in included files and may be used where the include file is not part of the test-suite itself.
Expected uses are for diagnostics originating in system headers, or for users who use -verify in testing 3rd-party library code where the location of diagnostics in header files may change from revision to revision and their precise location is not important to the success of the test-case.
llvm-svn: 212735
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Frontend/verify.c | 11 | ||||
| -rw-r--r-- | clang/test/Frontend/verify2.c | 21 | ||||
| -rw-r--r-- | clang/test/Frontend/verify2.h | 4 |
3 files changed, 32 insertions, 4 deletions
diff --git a/clang/test/Frontend/verify.c b/clang/test/Frontend/verify.c index 4bd0c90b4ae..e2e7894f3b9 100644 --- a/clang/test/Frontend/verify.c +++ b/clang/test/Frontend/verify.c @@ -134,9 +134,18 @@ unexpected b; // expected-error@33 1-1 {{unknown type}} // expected-warning@verify-directive.h: {{ }} // expected-error@-1 {{missing or invalid line number}} +// expected-warning@verify-directive.h:0 {{ }} +// expected-error@-1 {{missing or invalid line number}} + +// expected-warning@verify-directive.h:0*{{ }} +// expected-error@-1 {{missing or invalid line number}} + +// expected-warning@verify-directive.h:*0{{ }} +// syntactically ok -- means match in any line for 0 occurrences. + // expected-warning@verify-directive.h:1 {{diagnostic}} // CHECK8: error: 'warning' diagnostics expected but not seen: -// CHECK8-NEXT: File {{.*}}verify-directive.h Line 1 (directive at {{.*}}verify.c:137): diagnostic +// CHECK8-NEXT: File {{.*}}verify-directive.h Line 1 (directive at {{.*}}verify.c:146): diagnostic // CHECK8-NEXT: 1 error generated. #endif diff --git a/clang/test/Frontend/verify2.c b/clang/test/Frontend/verify2.c index 73eda4d815d..075a2ab6e0f 100644 --- a/clang/test/Frontend/verify2.c +++ b/clang/test/Frontend/verify2.c @@ -14,7 +14,26 @@ // CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics' // CHECK-NEXT: error: 'error' diagnostics seen but not expected: -// CHECK-NEXT: Line 1: header +// CHECK-NEXT: Line 5: header // CHECK-NEXT: Line 10: source // CHECK-NEXT: 3 errors generated. #endif + +#ifdef CHECK2 +// RUN: not %clang_cc1 -DCHECK2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s + +// The following checks that -verify can match "any line" in an included file. +// The location of the diagnostic need therefore only match in the file, not to +// a specific line number. This is useful where -verify is used as a testing +// tool for 3rd-party libraries where headers may change and the specific line +// number of a diagnostic in a header is not important. + +// expected-error@verify2.h:* {{header}} +// expected-error@verify2.h:* {{unknown}} + +// CHECK2: error: 'error' diagnostics expected but not seen: +// CHECK2-NEXT: File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown +// CHECK2-NEXT: error: 'error' diagnostics seen but not expected: +// CHECK2-NEXT: File {{.*}}verify2.c Line 10: source +// CHECK2-NEXT: 2 errors generated. +#endif diff --git a/clang/test/Frontend/verify2.h b/clang/test/Frontend/verify2.h index 8acbf6efdfe..a426722ee6e 100644 --- a/clang/test/Frontend/verify2.h +++ b/clang/test/Frontend/verify2.h @@ -1,5 +1,5 @@ -#error header - #if 0 // expected-error {{should be ignored}} #endif + +#error header |

