Clang Project

clang_source_code/test/Frontend/system-header-line-directive.c
1// RUN: %clang_cc1 -Wall %s -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix -verify
2// RUN: %clang_cc1 %s -E -o - -I %S/Inputs -isystem %S/Inputs/SystemHeaderPrefix | FileCheck %s
3#include <noline.h>
4#include <line-directive-in-system.h>
5
6// expected-warning@line-directive.h:* {{type specifier missing, defaults to 'int'}}
7#include "line-directive.h"
8
9// This tests that "#line" directives in system headers preserve system
10// header-ness just like GNU line markers that don't have filenames.  This was
11// PR30752.
12
13// CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2
14// CHECK: # 1 "{{.*}}noline.h" 1 3
15// CHECK: foo();
16// CHECK: # 4 "{{.*}}system-header-line-directive.c" 2
17// CHECK: # 1 "{{.*}}line-directive-in-system.h" 1 3
18//      The "3" below indicates that "foo.h" is considered a system header.
19// CHECK: # 1 "foo.h" 3
20// CHECK: foo();
21// CHECK: # {{[0-9]+}} "{{.*}}system-header-line-directive.c" 2
22// CHECK: # 1 "{{.*}}line-directive.h" 1
23// CHECK: # 10 "foo.h"{{$}}
24