diff options
| author | Reid Kleckner <rnk@google.com> | 2017-05-23 16:09:13 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2017-05-23 16:09:13 +0000 |
| commit | 1ace0049fe09601821bf2d56183be6f1ed8ada26 (patch) | |
| tree | f7f9bbfb224253a806c118ecfb540d5201f4fdb2 /clang/test | |
| parent | a96ec3f36016eee02c346e9b8100f31f28a6f079 (diff) | |
| download | bcm5719-llvm-1ace0049fe09601821bf2d56183be6f1ed8ada26.tar.gz bcm5719-llvm-1ace0049fe09601821bf2d56183be6f1ed8ada26.zip | |
Add test coverage for recent behavior change in GNU line marker pre-processing
llvm-svn: 303642
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Frontend/Inputs/SystemHeaderPrefix/line-directive-in-system.h (renamed from clang/test/Frontend/Inputs/SystemHeaderPrefix/line.h) | 0 | ||||
| -rw-r--r-- | clang/test/Frontend/Inputs/line-directive.h | 2 | ||||
| -rw-r--r-- | clang/test/Frontend/system-header-line-directive.c | 15 | ||||
| -rw-r--r-- | clang/test/Preprocessor/line-directive-output.c | 7 |
4 files changed, 18 insertions, 6 deletions
diff --git a/clang/test/Frontend/Inputs/SystemHeaderPrefix/line.h b/clang/test/Frontend/Inputs/SystemHeaderPrefix/line-directive-in-system.h index c4c15e58e4d..c4c15e58e4d 100644 --- a/clang/test/Frontend/Inputs/SystemHeaderPrefix/line.h +++ b/clang/test/Frontend/Inputs/SystemHeaderPrefix/line-directive-in-system.h diff --git a/clang/test/Frontend/Inputs/line-directive.h b/clang/test/Frontend/Inputs/line-directive.h new file mode 100644 index 00000000000..e05e9f51677 --- /dev/null +++ b/clang/test/Frontend/Inputs/line-directive.h @@ -0,0 +1,2 @@ +#line 10 "foo.h" +foo(); // will warn if not treated as a system header diff --git a/clang/test/Frontend/system-header-line-directive.c b/clang/test/Frontend/system-header-line-directive.c index 16dde643a5b..9d4f09885f9 100644 --- a/clang/test/Frontend/system-header-line-directive.c +++ b/clang/test/Frontend/system-header-line-directive.c @@ -1,20 +1,23 @@ -// RUN: %clang_cc1 -Wall %s -isystem %S/Inputs/SystemHeaderPrefix -verify -// RUN: %clang_cc1 %s -E -o - -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s +// RUN: %clang_cc1 -Wall %s -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix -verify +// RUN: %clang_cc1 %s -E -o - -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s #include <noline.h> -#include <line.h> +#include <line-directive-in-system.h> + +// expected-warning@line-directive.h:* {{type specifier missing, defaults to 'int'}} +#include "line-directive.h" // This tests that "#line" directives in system headers preserve system // header-ness just like GNU line markers that don't have filenames. This was // PR30752. -// expected-no-diagnostics - // CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2 // CHECK: # 1 "{{.*}}noline.h" 1 3 // CHECK: foo(); // CHECK: # 4 "{{.*}}system-header-line-directive.c" 2 -// CHECK: # 1 "{{.*}}line.h" 1 3 +// CHECK: # 1 "{{.*}}line-directive-in-system.h" 1 3 // The "3" below indicates that "foo.h" is considered a system header. // CHECK: # 1 "foo.h" 3 // CHECK: foo(); // CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2 +// CHECK: # 1 "{{.*}}line-directive.h" 1 +// CHECK: # 10 "foo.h"{{$}} diff --git a/clang/test/Preprocessor/line-directive-output.c b/clang/test/Preprocessor/line-directive-output.c index 5c0aef8b321..caeb88dd855 100644 --- a/clang/test/Preprocessor/line-directive-output.c +++ b/clang/test/Preprocessor/line-directive-output.c @@ -76,3 +76,10 @@ extern int z; // CHECK: # 50 "a\n.c" # 50 "a\012.c" + +# 1 "system.h" 3 +# 2 +void sys_foo(void); +// CHECK: # 1 "system.h" 3 +// CHECK-NEXT: # 2 "system.h" 3 +// CHECK-NEXT: void sys_foo(void); |

