blob: 137efe839379584dd839122e8fedc3eefda492a7 [file] [log] [blame]
Michael Kruseae6b4002021-07-25 21:39:08 -05001// RUN: %clang_cc1 -fminimize-whitespace -E %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCOL
2// RUN: %clang_cc1 -fminimize-whitespace -E -C %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCCOL
3// RUN: %clang_cc1 -fminimize-whitespace -E -P %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINWS
4// RUN: %clang_cc1 -fminimize-whitespace -E -C -P %s 2>&1 | FileCheck %s --strict-whitespace --check-prefix=MINCWS
Michael Krusec6b0b162021-07-28 22:01:14 -05005// The follow empty lines ensure that a #line directive is emitted instead of newline padding after the RUN comments.
6
7
8
9
10
Michael Kruseae6b4002021-07-25 21:39:08 -050011
12#define NOT_OMP omp something
13#define HASH #
14
15 int a; /* span-comment */
16 int b ; // line-comment
17 _Pragma ( "omp barrier" ) x // more line-comments
18 #pragma omp nothing // another comment
19HASH pragma NOT_OMP
20 int e; // again a line
21 int \
22f ;
23
24
Michael Krusec6b0b162021-07-28 22:01:14 -050025// MINCOL: {{^}}# 15 "{{.*}}minimize-whitespace.c"{{$}}
Michael Kruseae6b4002021-07-25 21:39:08 -050026// MINCOL: {{^}}int a;{{$}}
27// MINCOL-NEXT: {{^}}int b;{{$}}
28// MINCOL-NEXT: {{^}}#pragma omp barrier{{$}}
Michael Krusec6b0b162021-07-28 22:01:14 -050029// MINCOL-NEXT: # 17 "{{.*}}minimize-whitespace.c"
Michael Kruseae6b4002021-07-25 21:39:08 -050030// MINCOL-NEXT: {{^}}x{{$}}
31// MINCOL-NEXT: {{^}}#pragma omp nothing{{$}}
32// MINCOL-NEXT: {{^ }}#pragma omp something{{$}}
33// MINCOL-NEXT: {{^}}int e;{{$}}
34// MINCOL-NEXT: {{^}}int f;{{$}}
35
36// FIXME: Comments after pragmas disappear, even without -fminimize-whitespace
Michael Krusec6b0b162021-07-28 22:01:14 -050037// MINCCOL: {{^}}# 15 "{{.*}}minimize-whitespace.c"{{$}}
Michael Kruseae6b4002021-07-25 21:39:08 -050038// MINCCOL: {{^}}int a;/* span-comment */{{$}}
39// MINCCOL-NEXT: {{^}}int b;// line-comment{{$}}
40// MINCCOL-NEXT: {{^}}#pragma omp barrier{{$}}
Michael Krusec6b0b162021-07-28 22:01:14 -050041// MINCCOL-NEXT: # 17 "{{.*}}minimize-whitespace.c"
Michael Kruseae6b4002021-07-25 21:39:08 -050042// MINCCOL-NEXT: {{^}}x// more line-comments{{$}}
43// MINCCOL-NEXT: {{^}}#pragma omp nothing{{$}}
44// MINCCOL-NEXT: {{^ }}#pragma omp something{{$}}
45// MINCCOL-NEXT: {{^}}int e;// again a line{{$}}
46// MINCCOL-NEXT: {{^}}int f;{{$}}
47
48// MINWS: {{^}}int a;int b;{{$}}
49// MINWS-NEXT: {{^}}#pragma omp barrier{{$}}
50// MINWS-NEXT: {{^}}x{{$}}
51// MINWS-NEXT: {{^}}#pragma omp nothing{{$}}
52// MINWS-NEXT: {{^ }}#pragma omp something int e;int f;{{$}}
53
54// FIXME: Comments after pragmas disappear, even without -fminimize-whitespace
55// MINCWS: {{^}}int a;/* span-comment */int b;// line-comment{{$}}
56// MINCWS-NEXT: {{^}}#pragma omp barrier{{$}}
57// MINCWS-NEXT: {{^}}x// more line-comments{{$}}
58// MINCWS-NEXT: {{^}}#pragma omp nothing{{$}}
59// MINCWS-NEXT: {{^ }}#pragma omp something int e;// again a line{{$}}
60// MINCWS-NEXT: {{^}}int f;
61