jdenny created this revision. jdenny added a reviewer: ABataev. Herald added a subscriber: guansong.
-ast-print prints omp pragmas with a trailing space. While this behavior is likely of little concern to most users, surely it's unintentional, and it's annoying for some source-level work I'm pursuing. This patch focuses on omp pragmas, but it also fixes init_seg and loop hint pragmas because they share implementation. The testing strategy here is to add usually just one '{{$}}' per relevant -ast-print test file. This seems to achieve good code coverage. However, this strategy is probably easy to forget as the tests evolve. That's probably fine as this fix is far from critical. The main goal of the testing is to aid the initial review. This patch also adds a fixme for "#pragma unroll", which prints as "#pragma unroll (enable)", which is invalid syntax. https://reviews.llvm.org/D43204 Files: include/clang/Basic/Attr.td lib/AST/StmtPrinter.cpp test/Misc/ast-print-pragmas.cpp test/OpenMP/atomic_ast_print.cpp test/OpenMP/barrier_ast_print.cpp test/OpenMP/cancel_ast_print.cpp test/OpenMP/cancellation_point_ast_print.cpp test/OpenMP/critical_ast_print.cpp test/OpenMP/declare_reduction_ast_print.c test/OpenMP/declare_reduction_ast_print.cpp test/OpenMP/declare_simd_ast_print.c test/OpenMP/declare_simd_ast_print.cpp test/OpenMP/declare_target_ast_print.cpp test/OpenMP/distribute_ast_print.cpp test/OpenMP/distribute_dist_schedule_ast_print.cpp test/OpenMP/distribute_parallel_for_ast_print.cpp test/OpenMP/distribute_parallel_for_simd_ast_print.cpp test/OpenMP/distribute_simd_ast_print.cpp test/OpenMP/flush_ast_print.cpp test/OpenMP/for_ast_print.cpp test/OpenMP/for_simd_ast_print.cpp test/OpenMP/master_ast_print.cpp test/OpenMP/ordered_ast_print.cpp test/OpenMP/parallel_ast_print.cpp test/OpenMP/parallel_for_ast_print.cpp test/OpenMP/parallel_for_simd_ast_print.cpp test/OpenMP/parallel_sections_ast_print.cpp test/OpenMP/sections_ast_print.cpp test/OpenMP/simd_ast_print.cpp test/OpenMP/single_ast_print.cpp test/OpenMP/target_ast_print.cpp test/OpenMP/target_data_ast_print.cpp test/OpenMP/target_data_use_device_ptr_ast_print.cpp test/OpenMP/target_enter_data_ast_print.cpp test/OpenMP/target_exit_data_ast_print.cpp test/OpenMP/target_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_ast_print.cpp test/OpenMP/target_parallel_for_ast_print.cpp test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_for_simd_ast_print.cpp test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp test/OpenMP/target_simd_ast_print.cpp test/OpenMP/target_teams_ast_print.cpp test/OpenMP/target_teams_distribute_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_distribute_simd_ast_print.cpp test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp test/OpenMP/target_teams_is_device_ptr_ast_print.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/task_ast_print.cpp test/OpenMP/taskgroup_ast_print.cpp test/OpenMP/taskloop_ast_print.cpp test/OpenMP/taskloop_simd_ast_print.cpp test/OpenMP/taskwait_ast_print.cpp test/OpenMP/taskyield_ast_print.cpp test/OpenMP/teams_ast_print.cpp test/OpenMP/teams_distribute_ast_print.cpp test/OpenMP/teams_distribute_parallel_for_ast_print.cpp test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp test/OpenMP/teams_distribute_simd_ast_print.cpp test/OpenMP/threadprivate_ast_print.cpp test/PCH/pragma-loop.cpp utils/TableGen/ClangAttrEmitter.cpp
Index: utils/TableGen/ClangAttrEmitter.cpp =================================================================== --- utils/TableGen/ClangAttrEmitter.cpp +++ utils/TableGen/ClangAttrEmitter.cpp @@ -1368,7 +1368,7 @@ " OS << \"" << Prefix << Spelling; if (Variety == "Pragma") { - OS << " \";\n"; + OS << "\";\n"; OS << " printPrettyPragma(OS, Policy);\n"; OS << " OS << \"\\n\";"; OS << " break;\n"; Index: test/PCH/pragma-loop.cpp =================================================================== --- test/PCH/pragma-loop.cpp +++ test/PCH/pragma-loop.cpp @@ -4,7 +4,7 @@ // FIXME: A bug in ParsedAttributes causes the order of the attributes to be // reversed. The checks are consequently in the reverse order below. -// CHECK: #pragma clang loop unroll_count(16) +// CHECK: #pragma clang loop unroll_count(16){{$}} // CHECK: #pragma clang loop interleave_count(8) // CHECK: #pragma clang loop vectorize_width(4) // CHECK: #pragma clang loop distribute(enable) @@ -15,9 +15,10 @@ // CHECK: #pragma clang loop unroll(full) // CHECK: #pragma clang loop interleave(enable) // CHECK: #pragma clang loop vectorize(disable) -// CHECK: #pragma unroll -// CHECK: #pragma unroll (32) -// CHECK: #pragma nounroll +// FIXME: "#pragma unroll (enable)" is invalid and is not the input source. +// CHECK: #pragma unroll (enable){{$}} +// CHECK: #pragma unroll (32){{$}} +// CHECK: #pragma nounroll{{$}} // CHECK: #pragma clang loop interleave_count(I) // CHECK: #pragma clang loop vectorize_width(V) Index: test/OpenMP/threadprivate_ast_print.cpp =================================================================== --- test/OpenMP/threadprivate_ast_print.cpp +++ test/OpenMP/threadprivate_ast_print.cpp @@ -25,7 +25,7 @@ static int b; // CHECK: static int b; #pragma omp threadprivate(b) -// CHECK-NEXT: #pragma omp threadprivate(St1::b) +// CHECK-NEXT: #pragma omp threadprivate(St1::b){{$}} } d; int a, b; Index: test/OpenMP/teams_distribute_simd_ast_print.cpp =================================================================== --- test/OpenMP/teams_distribute_simd_ast_print.cpp +++ test/OpenMP/teams_distribute_simd_ast_print.cpp @@ -126,7 +126,7 @@ for (int i=0; i < 2; ++i) a = 2; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute simd +// CHECK-NEXT: #pragma omp teams distribute simd{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target Index: test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp =================================================================== --- test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp +++ test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp @@ -132,7 +132,7 @@ for (int i=0; i < 2; ++i) a = 2; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for simd +// CHECK-NEXT: #pragma omp teams distribute parallel for simd{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target Index: test/OpenMP/teams_distribute_parallel_for_ast_print.cpp =================================================================== --- test/OpenMP/teams_distribute_parallel_for_ast_print.cpp +++ test/OpenMP/teams_distribute_parallel_for_ast_print.cpp @@ -108,7 +108,7 @@ for (int i=0; i < 2; ++i) a = 2; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for +// CHECK-NEXT: #pragma omp teams distribute parallel for{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target Index: test/OpenMP/teams_distribute_ast_print.cpp =================================================================== --- test/OpenMP/teams_distribute_ast_print.cpp +++ test/OpenMP/teams_distribute_ast_print.cpp @@ -100,7 +100,7 @@ for (int i=0; i < 2; ++i) a = 2; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute +// CHECK-NEXT: #pragma omp teams distribute{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target Index: test/OpenMP/teams_ast_print.cpp =================================================================== --- test/OpenMP/teams_ast_print.cpp +++ test/OpenMP/teams_ast_print.cpp @@ -54,7 +54,7 @@ // CHECK-NEXT: static T a; // CHECK-NEXT: S<T> s; // CHECK-NEXT: #pragma omp target -// CHECK-NEXT: #pragma omp teams +// CHECK-NEXT: #pragma omp teams{{$}} // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) Index: test/OpenMP/taskyield_ast_print.cpp =================================================================== --- test/OpenMP/taskyield_ast_print.cpp +++ test/OpenMP/taskyield_ast_print.cpp @@ -19,7 +19,7 @@ return a + argc; } // CHECK: static T a; -// CHECK-NEXT: #pragma omp taskyield +// CHECK-NEXT: #pragma omp taskyield{{$}} // CHECK: static int a; // CHECK-NEXT: #pragma omp taskyield // CHECK: static char a; Index: test/OpenMP/taskwait_ast_print.cpp =================================================================== --- test/OpenMP/taskwait_ast_print.cpp +++ test/OpenMP/taskwait_ast_print.cpp @@ -19,7 +19,7 @@ return a + argc; } // CHECK: static T a; -// CHECK-NEXT: #pragma omp taskwait +// CHECK-NEXT: #pragma omp taskwait{{$}} // CHECK: static int a; // CHECK-NEXT: #pragma omp taskwait // CHECK: static char a; Index: test/OpenMP/taskloop_simd_ast_print.cpp =================================================================== --- test/OpenMP/taskloop_simd_ast_print.cpp +++ test/OpenMP/taskloop_simd_ast_print.cpp @@ -21,7 +21,7 @@ #pragma omp taskgroup task_reduction(+: d) #pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d) // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d) + // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}} for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) Index: test/OpenMP/taskloop_ast_print.cpp =================================================================== --- test/OpenMP/taskloop_ast_print.cpp +++ test/OpenMP/taskloop_ast_print.cpp @@ -20,7 +20,7 @@ #pragma omp taskgroup task_reduction(+: d) #pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+:g) in_reduction(+: d) // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+: g) in_reduction(+: d) + // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+: g) in_reduction(+: d){{$}} for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) Index: test/OpenMP/taskgroup_ast_print.cpp =================================================================== --- test/OpenMP/taskgroup_ast_print.cpp +++ test/OpenMP/taskgroup_ast_print.cpp @@ -74,7 +74,7 @@ // CHECK: static int a; #pragma omp taskgroup a=2; -// CHECK-NEXT: #pragma omp taskgroup +// CHECK-NEXT: #pragma omp taskgroup{{$}} // CHECK-NEXT: a = 2; // CHECK-NEXT: ++a; ++a; Index: test/OpenMP/task_ast_print.cpp =================================================================== --- test/OpenMP/task_ast_print.cpp +++ test/OpenMP/task_ast_print.cpp @@ -42,7 +42,7 @@ }; // CHECK: #pragma omp taskgroup task_reduction(+: this->b) -// CHECK: #pragma omp task private(this->a) private(this->a) private(T::a) in_reduction(+: this->b) +// CHECK: #pragma omp task private(this->a) private(this->a) private(T::a) in_reduction(+: this->b){{$}} // CHECK: #pragma omp task private(this->a) private(this->a) // CHECK: #pragma omp task private(this->a) private(this->a) private(this->S1::a) Index: test/OpenMP/target_update_ast_print.cpp =================================================================== --- test/OpenMP/target_update_ast_print.cpp +++ test/OpenMP/target_update_ast_print.cpp @@ -25,7 +25,7 @@ // CHECK: static T a; // CHECK-NEXT: U b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l){{$}} // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) // CHECK: static int a; // CHECK-NEXT: float b; Index: test/OpenMP/target_teams_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_teams_is_device_ptr_ast_print.cpp @@ -53,7 +53,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target teams is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target teams is_device_ptr(this->k){{$}} // CHECK-NEXT: { // CHECK-NEXT: } // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->z) Index: test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp @@ -60,7 +60,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target teams distribute simd is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target teams distribute simd is_device_ptr(this->k){{$}} // CHECK-NEXT: for (int i = 0; i < 100; i++) // CHECK-NEXT: ; // CHECK-NEXT: #pragma omp target teams distribute simd is_device_ptr(this->z) Index: test/OpenMP/target_teams_distribute_simd_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_simd_ast_print.cpp +++ test/OpenMP/target_teams_distribute_simd_ast_print.cpp @@ -107,7 +107,7 @@ #pragma omp target teams distribute simd for (int i=0; i < 2; ++i) a = 2; -// CHECK: #pragma omp target teams distribute simd +// CHECK: #pragma omp target teams distribute simd{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target teams distribute simd private(argc, b), firstprivate(c, d), collapse(2) Index: test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp @@ -60,7 +60,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target teams distribute parallel for simd is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target teams distribute parallel for simd is_device_ptr(this->k){{$}} // CHECK-NEXT: for (int i = 0; i < 100; i++) // CHECK-NEXT: ; // CHECK-NEXT: #pragma omp target teams distribute parallel for simd is_device_ptr(this->z) Index: test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp +++ test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp @@ -113,7 +113,7 @@ #pragma omp target teams distribute parallel for simd for (int i=0; i < 2; ++i) a = 2; -// CHECK: #pragma omp target teams distribute parallel for simd +// CHECK: #pragma omp target teams distribute parallel for simd{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target teams distribute parallel for simd private(argc, b), firstprivate(c, d), collapse(2) Index: test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp @@ -60,7 +60,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target teams distribute parallel for is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target teams distribute parallel for is_device_ptr(this->k){{$}} // CHECK-NEXT: for (int i = 0; i < 100; i++) // CHECK-NEXT: ; // CHECK-NEXT: #pragma omp target teams distribute parallel for is_device_ptr(this->z) Index: test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp +++ test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp @@ -93,7 +93,7 @@ #pragma omp target teams distribute parallel for for (int i=0; i < 2; ++i) a = 2; -// CHECK: #pragma omp target teams distribute parallel for +// CHECK: #pragma omp target teams distribute parallel for{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target teams distribute parallel for private(argc, b), firstprivate(c, d), collapse(2) Index: test/OpenMP/target_teams_distribute_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_distribute_ast_print.cpp +++ test/OpenMP/target_teams_distribute_ast_print.cpp @@ -85,7 +85,7 @@ #pragma omp target teams distribute for (int i=0; i < 2; ++i) a = 2; -// CHECK: #pragma omp target teams distribute +// CHECK: #pragma omp target teams distribute{{$}} // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target teams distribute private(argc, b), firstprivate(c, d), collapse(2) Index: test/OpenMP/target_teams_ast_print.cpp =================================================================== --- test/OpenMP/target_teams_ast_print.cpp +++ test/OpenMP/target_teams_ast_print.cpp @@ -50,7 +50,7 @@ // CHECK-NEXT: T b = argc, c, d, e, f, g; // CHECK-NEXT: static T a; // CHECK-NEXT: S<T> s; -// CHECK-NEXT: #pragma omp target teams +// CHECK-NEXT: #pragma omp target teams{{$}} // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) // CHECK-NEXT: foo() Index: test/OpenMP/target_simd_ast_print.cpp =================================================================== --- test/OpenMP/target_simd_ast_print.cpp +++ test/OpenMP/target_simd_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp target simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp target simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp target simd private(this->a) private(this->a) // CHECK: #pragma omp target simd private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp @@ -54,7 +54,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target parallel is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target parallel is_device_ptr(this->k){{$}} // CHECK-NEXT: { // CHECK-NEXT: } // CHECK-NEXT: #pragma omp target parallel is_device_ptr(this->z) Index: test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp @@ -60,7 +60,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target parallel for simd is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target parallel for simd is_device_ptr(this->k){{$}} // CHECK-NEXT: for (int i = 0; i < 100; i++) // CHECK-NEXT: ; // CHECK-NEXT: #pragma omp target parallel for simd is_device_ptr(this->z) Index: test/OpenMP/target_parallel_for_simd_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_for_simd_ast_print.cpp +++ test/OpenMP/target_parallel_for_simd_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) // CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp @@ -63,7 +63,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target parallel for is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target parallel for is_device_ptr(this->k){{$}} // CHECK-NEXT: for (int i = 0; i < 100; i++) // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp target parallel for is_device_ptr(this->z) Index: test/OpenMP/target_parallel_for_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_for_ast_print.cpp +++ test/OpenMP/target_parallel_for_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp target parallel for private(this->a) private(this->a) // CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/target_parallel_ast_print.cpp =================================================================== --- test/OpenMP/target_parallel_ast_print.cpp +++ test/OpenMP/target_parallel_ast_print.cpp @@ -74,7 +74,7 @@ // CHECK-NEXT: S<T> s; // CHECK-NEXT: T arr[C][10], arr1[C]; // CHECK-NEXT: T i, j, a[20] -// CHECK-NEXT: #pragma omp target parallel +// CHECK-NEXT: #pragma omp target parallel{{$}} // CHECK-NEXT: h = 2; // CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) // CHECK-NEXT: foo() Index: test/OpenMP/target_is_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_is_device_ptr_ast_print.cpp +++ test/OpenMP/target_is_device_ptr_ast_print.cpp @@ -54,7 +54,7 @@ // CHECK-NEXT: int aa[10]; // CHECK-NEXT: arr &raa = this->aa; // CHECK-NEXT: func( -// CHECK-NEXT: #pragma omp target is_device_ptr(this->k) +// CHECK-NEXT: #pragma omp target is_device_ptr(this->k){{$}} // CHECK-NEXT: { // CHECK-NEXT: } // CHECK-NEXT: #pragma omp target is_device_ptr(this->z) Index: test/OpenMP/target_exit_data_ast_print.cpp =================================================================== --- test/OpenMP/target_exit_data_ast_print.cpp +++ test/OpenMP/target_exit_data_ast_print.cpp @@ -73,7 +73,7 @@ // CHECK: template <typename T, int C> T tmain(T argc, T *argv) { // CHECK-NEXT: T i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; -// CHECK-NEXT: #pragma omp target exit data map(from: i) +// CHECK-NEXT: #pragma omp target exit data map(from: i){{$}} // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0) // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) // CHECK-NEXT: #pragma omp target exit data map(from: c) Index: test/OpenMP/target_enter_data_ast_print.cpp =================================================================== --- test/OpenMP/target_enter_data_ast_print.cpp +++ test/OpenMP/target_enter_data_ast_print.cpp @@ -69,7 +69,7 @@ // CHECK: template <typename T, int C> T tmain(T argc, T *argv) { // CHECK-NEXT: T i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; -// CHECK-NEXT: #pragma omp target enter data map(to: i) +// CHECK-NEXT: #pragma omp target enter data map(to: i){{$}} // CHECK-NEXT: #pragma omp target enter data map(to: i) if(target enter data: j > 0) // CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) // CHECK-NEXT: #pragma omp target enter data map(to: c) Index: test/OpenMP/target_data_use_device_ptr_ast_print.cpp =================================================================== --- test/OpenMP/target_data_use_device_ptr_ast_print.cpp +++ test/OpenMP/target_data_use_device_ptr_ast_print.cpp @@ -26,7 +26,7 @@ }; // CHECK: struct SA // CHECK: void func( -// CHECK: #pragma omp target data map(tofrom: this->i) use_device_ptr(this->k) +// CHECK: #pragma omp target data map(tofrom: this->i) use_device_ptr(this->k){{$}} // CHECK: #pragma omp target data map(tofrom: this->i) use_device_ptr(this->z) struct SB { unsigned A; Index: test/OpenMP/target_data_ast_print.cpp =================================================================== --- test/OpenMP/target_data_ast_print.cpp +++ test/OpenMP/target_data_ast_print.cpp @@ -52,7 +52,7 @@ // CHECK: template <typename T, int C> T tmain(T argc, T *argv) { // CHECK-NEXT: T i, j, b, c, d, e, x[20]; -// CHECK-NEXT: #pragma omp target data map(to: c) +// CHECK-NEXT: #pragma omp target data map(to: c){{$}} // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0) // CHECK-NEXT: foo(); Index: test/OpenMP/target_ast_print.cpp =================================================================== --- test/OpenMP/target_ast_print.cpp +++ test/OpenMP/target_ast_print.cpp @@ -46,7 +46,7 @@ // CHECK: template <typename T, int C> T tmain(T argc, T *argv) { // CHECK-NEXT: T i, j, a[20] -// CHECK-NEXT: #pragma omp target +// CHECK-NEXT: #pragma omp target{{$}} // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp target if(target: argc > 0) // CHECK-NEXT: foo() Index: test/OpenMP/single_ast_print.cpp =================================================================== --- test/OpenMP/single_ast_print.cpp +++ test/OpenMP/single_ast_print.cpp @@ -20,7 +20,7 @@ #pragma omp parallel firstprivate(a, b, c) #pragma omp single copyprivate(a, this->b, (this)->c) // CHECK: #pragma omp parallel firstprivate(this->a,this->b,this->c) -// CHECK-NEXT: #pragma omp single copyprivate(this->a,this->b,this->c) +// CHECK-NEXT: #pragma omp single copyprivate(this->a,this->b,this->c){{$}} ++this->a, --b, (this)->c /= 1; } }; Index: test/OpenMP/simd_ast_print.cpp =================================================================== --- test/OpenMP/simd_ast_print.cpp +++ test/OpenMP/simd_ast_print.cpp @@ -38,7 +38,7 @@ } }; -// CHECK: #pragma omp simd aligned(this->a) +// CHECK: #pragma omp simd aligned(this->a){{$}} // CHECK: #pragma omp simd aligned(this->b: 8) // CHECK: #pragma omp simd aligned(this->a) @@ -153,7 +153,7 @@ static int *a; // CHECK: static int *a; #pragma omp simd -// CHECK-NEXT: #pragma omp simd +// CHECK-NEXT: #pragma omp simd{{$}} for (int i=0; i < 2; ++i)*a=2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: *a = 2; Index: test/OpenMP/sections_ast_print.cpp =================================================================== --- test/OpenMP/sections_ast_print.cpp +++ test/OpenMP/sections_ast_print.cpp @@ -23,7 +23,7 @@ foo(); } // CHECK-NEXT: #pragma omp parallel - // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait + // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait{{$}} // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } @@ -46,7 +46,7 @@ // CHECK-NEXT: #pragma omp parallel // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait // CHECK-NEXT: { - // CHECK-NEXT: #pragma omp section + // CHECK-NEXT: #pragma omp section{{$}} // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section // CHECK-NEXT: foo(); Index: test/OpenMP/parallel_sections_ast_print.cpp =================================================================== --- test/OpenMP/parallel_sections_ast_print.cpp +++ test/OpenMP/parallel_sections_ast_print.cpp @@ -58,7 +58,7 @@ // CHECK-NEXT: T b = argc, c, d, e, f, g; // CHECK-NEXT: static T a; // CHECK-NEXT: S<T> s; -// CHECK-NEXT: #pragma omp parallel sections +// CHECK-NEXT: #pragma omp parallel sections{{$}} // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } Index: test/OpenMP/parallel_for_simd_ast_print.cpp =================================================================== --- test/OpenMP/parallel_for_simd_ast_print.cpp +++ test/OpenMP/parallel_for_simd_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp parallel for simd private(this->a) private(this->a) // CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(this->S1::a) Index: test/OpenMP/parallel_for_ast_print.cpp =================================================================== --- test/OpenMP/parallel_for_ast_print.cpp +++ test/OpenMP/parallel_for_ast_print.cpp @@ -39,7 +39,7 @@ } }; -// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp parallel for private(this->a) private(this->a) // CHECK: #pragma omp parallel for private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/parallel_ast_print.cpp =================================================================== --- test/OpenMP/parallel_ast_print.cpp +++ test/OpenMP/parallel_ast_print.cpp @@ -162,7 +162,7 @@ // CHECK-NEXT: static T a; // CHECK-NEXT: S<T> s; // CHECK-NEXT: T arr[C][10], arr1[C]; -// CHECK-NEXT: #pragma omp parallel +// CHECK-NEXT: #pragma omp parallel{{$}} // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S<T>::TS,thrp) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) // CHECK-NEXT: foo() Index: test/OpenMP/ordered_ast_print.cpp =================================================================== --- test/OpenMP/ordered_ast_print.cpp +++ test/OpenMP/ordered_ast_print.cpp @@ -58,7 +58,7 @@ // CHECK: static T a; // CHECK-NEXT: #pragma omp for ordered // CHECK-NEXT: for (int i = 0; i < argc; ++i) -// CHECK-NEXT: #pragma omp ordered +// CHECK-NEXT: #pragma omp ordered{{$}} // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } Index: test/OpenMP/master_ast_print.cpp =================================================================== --- test/OpenMP/master_ast_print.cpp +++ test/OpenMP/master_ast_print.cpp @@ -25,7 +25,7 @@ } // CHECK-NEXT: #pragma omp parallel // CHECK-NEXT: { -// CHECK-NEXT: #pragma omp master +// CHECK-NEXT: #pragma omp master{{$}} // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } Index: test/OpenMP/for_simd_ast_print.cpp =================================================================== --- test/OpenMP/for_simd_ast_print.cpp +++ test/OpenMP/for_simd_ast_print.cpp @@ -37,7 +37,7 @@ } }; -// CHECK: #pragma omp for simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp for simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp for simd private(this->a) private(this->a) // CHECK: #pragma omp for simd private(this->a) private(this->a) private(this->S1::a) Index: test/OpenMP/for_ast_print.cpp =================================================================== --- test/OpenMP/for_ast_print.cpp +++ test/OpenMP/for_ast_print.cpp @@ -169,7 +169,7 @@ for (q = &buf[0]; q <= buf + 7; q++) foo(); // CHECK: #pragma omp parallel - // CHECK-NEXT: #pragma omp for + // CHECK-NEXT: #pragma omp for{{$}} // CHECK-NEXT: for (p = buf; p < &buf[8]; p++) // CHECK-NEXT: for (q = &buf[0]; q <= buf + 7; q++) // CHECK-NEXT: foo(); Index: test/OpenMP/flush_ast_print.cpp =================================================================== --- test/OpenMP/flush_ast_print.cpp +++ test/OpenMP/flush_ast_print.cpp @@ -20,7 +20,7 @@ return a + argc; } // CHECK: static T a; -// CHECK-NEXT: #pragma omp flush +// CHECK-NEXT: #pragma omp flush{{$}} // CHECK-NEXT: #pragma omp flush (a) // CHECK: static int a; // CHECK-NEXT: #pragma omp flush Index: test/OpenMP/distribute_simd_ast_print.cpp =================================================================== --- test/OpenMP/distribute_simd_ast_print.cpp +++ test/OpenMP/distribute_simd_ast_print.cpp @@ -41,7 +41,7 @@ } }; -// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp distribute simd private(this->a) private(this->a) // CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/distribute_parallel_for_simd_ast_print.cpp =================================================================== --- test/OpenMP/distribute_parallel_for_simd_ast_print.cpp +++ test/OpenMP/distribute_parallel_for_simd_ast_print.cpp @@ -42,7 +42,7 @@ } }; -// CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) linear(k) // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/distribute_parallel_for_ast_print.cpp =================================================================== --- test/OpenMP/distribute_parallel_for_ast_print.cpp +++ test/OpenMP/distribute_parallel_for_ast_print.cpp @@ -41,7 +41,7 @@ } }; -// CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(T::a) +// CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(T::a){{$}} // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S::a) Index: test/OpenMP/distribute_dist_schedule_ast_print.cpp =================================================================== --- test/OpenMP/distribute_dist_schedule_ast_print.cpp +++ test/OpenMP/distribute_dist_schedule_ast_print.cpp @@ -18,7 +18,7 @@ static T a; // CHECK: static T a; #pragma omp distribute dist_schedule(static,10) -// CHECK-NEXT: #pragma omp distribute dist_schedule(static, 10) +// CHECK-NEXT: #pragma omp distribute dist_schedule(static, 10){{$}} for (int i=0; i < 2; ++i)a=2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; Index: test/OpenMP/distribute_ast_print.cpp =================================================================== --- test/OpenMP/distribute_ast_print.cpp +++ test/OpenMP/distribute_ast_print.cpp @@ -87,7 +87,7 @@ static T a; // CHECK: static T a; #pragma omp distribute -// CHECK-NEXT: #pragma omp distribute +// CHECK-NEXT: #pragma omp distribute{{$}} for (int i=0; i < 2; ++i)a=2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; Index: test/OpenMP/declare_target_ast_print.cpp =================================================================== --- test/OpenMP/declare_target_ast_print.cpp +++ test/OpenMP/declare_target_ast_print.cpp @@ -11,11 +11,11 @@ #define HEADER #pragma omp declare target -// CHECK: #pragma omp declare target +// CHECK: #pragma omp declare target{{$}} void foo() {} // CHECK-NEXT: void foo() #pragma omp end declare target -// CHECK: #pragma omp end declare target +// CHECK: #pragma omp end declare target{{$}} extern "C" { #pragma omp declare target @@ -87,41 +87,41 @@ void f1() { } #pragma omp declare target (a1, f1) -// CHECK: #pragma omp declare target +// CHECK: #pragma omp declare target{{$}} // CHECK: int a1; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target{{$}} // CHECK: void f1() -// CHECK: #pragma omp end declare target +// CHECK: #pragma omp end declare target{{$}} int b1, b2, b3; void f2() { } #pragma omp declare target to(b1) to(b2), to(b3, f2) -// CHECK: #pragma omp declare target +// CHECK: #pragma omp declare target{{$}} // CHECK: int b1; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target{{$}} // CHECK: int b2; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target{{$}} // CHECK: int b3; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target{{$}} // CHECK: void f2() -// CHECK: #pragma omp end declare target +// CHECK: #pragma omp end declare target{{$}} int c1, c2, c3; #pragma omp declare target link(c1) link(c2), link(c3) -// CHECK: #pragma omp declare target link +// CHECK: #pragma omp declare target link{{$}} // CHECK: int c1; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target link +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target link{{$}} // CHECK: int c2; -// CHECK: #pragma omp end declare target -// CHECK: #pragma omp declare target link +// CHECK: #pragma omp end declare target{{$}} +// CHECK: #pragma omp declare target link{{$}} // CHECK: int c3; -// CHECK: #pragma omp end declare target +// CHECK: #pragma omp end declare target{{$}} struct SSSt { #pragma omp declare target Index: test/OpenMP/declare_simd_ast_print.cpp =================================================================== --- test/OpenMP/declare_simd_ast_print.cpp +++ test/OpenMP/declare_simd_ast_print.cpp @@ -84,8 +84,8 @@ // CHECK-NEXT: float taddpf(float *a, T *&b) { // CHECK-NEXT: return *a + *b; // CHECK-NEXT: } -// CHECK: #pragma omp declare simd -// CHECK-NEXT: #pragma omp declare simd +// CHECK: #pragma omp declare simd uniform(this, b) +// CHECK-NEXT: #pragma omp declare simd{{$}} // CHECK-NEXT: int tadd(int b) { // CHECK-NEXT: return this->x[b] + b; // CHECK-NEXT: } Index: test/OpenMP/declare_simd_ast_print.c =================================================================== --- test/OpenMP/declare_simd_ast_print.c +++ test/OpenMP/declare_simd_ast_print.c @@ -16,10 +16,10 @@ #pragma omp declare simd notinbranch simdlen(2), uniform(s1, s2) linear(d: s1) void add_1(float *d, int s1, float *s2, double b[]) __attribute__((cold)); -// CHECK: #pragma omp declare simd notinbranch simdlen(2) uniform(s1, s2) linear(val(d): s1) -// CHECK-NEXT: #pragma omp declare simd inbranch uniform(d) linear(val(s1): 32) linear(val(s2): 32) -// CHECK-NEXT: #pragma omp declare simd simdlen(32) aligned(d) aligned(b) -// CHECK-NEXT: #pragma omp declare simd aligned(b: 64) +// CHECK: #pragma omp declare simd notinbranch simdlen(2) uniform(s1, s2) linear(val(d): s1){{$}} +// CHECK-NEXT: #pragma omp declare simd inbranch uniform(d) linear(val(s1): 32) linear(val(s2): 32){{$}} +// CHECK-NEXT: #pragma omp declare simd simdlen(32) aligned(d) aligned(b){{$}} +// CHECK-NEXT: #pragma omp declare simd aligned(b: 64){{$}} // CHECK-NEXT: void add_1(float *d, int s1, float *s2, double b[]) __attribute__((cold)) #endif Index: test/OpenMP/declare_reduction_ast_print.cpp =================================================================== --- test/OpenMP/declare_reduction_ast_print.cpp +++ test/OpenMP/declare_reduction_ast_print.cpp @@ -11,7 +11,7 @@ #define HEADER #pragma omp declare reduction(+ : int, char : omp_out *= omp_in) -// CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in) +// CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in){{$}} // CHECK-NEXT: #pragma omp declare reduction (+ : char : omp_out *= omp_in) template <class T> Index: test/OpenMP/declare_reduction_ast_print.c =================================================================== --- test/OpenMP/declare_reduction_ast_print.c +++ test/OpenMP/declare_reduction_ast_print.c @@ -11,7 +11,7 @@ #define HEADER #pragma omp declare reduction(+ : int, char : omp_out *= omp_in) -// CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in) +// CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in){{$}} // CHECK-NEXT: #pragma omp declare reduction (+ : char : omp_out *= omp_in) #pragma omp declare reduction(fun : float : omp_out += omp_in) initializer(omp_priv = omp_orig + 15) Index: test/OpenMP/critical_ast_print.cpp =================================================================== --- test/OpenMP/critical_ast_print.cpp +++ test/OpenMP/critical_ast_print.cpp @@ -14,10 +14,10 @@ // CHECK: template <typename T, int N> int tmain(T argc, char **argv) // CHECK: static int a; -// CHECK-NEXT: #pragma omp critical +// CHECK-NEXT: #pragma omp critical{{$}} // CHECK-NEXT: a = 2; // CHECK-NEXT: ++a; -// CHECK-NEXT: #pragma omp critical (the_name) hint(N) +// CHECK-NEXT: #pragma omp critical (the_name) hint(N){{$}} // CHECK-NEXT: foo(); // CHECK-NEXT: return N; // CHECK: template<> int tmain<int, 4>(int argc, char **argv) Index: test/OpenMP/cancellation_point_ast_print.cpp =================================================================== --- test/OpenMP/cancellation_point_ast_print.cpp +++ test/OpenMP/cancellation_point_ast_print.cpp @@ -18,7 +18,7 @@ } // CHECK: #pragma omp parallel // CHECK-NEXT: { -// CHECK-NEXT: #pragma omp cancellation point parallel +// CHECK-NEXT: #pragma omp cancellation point parallel{{$}} // CHECK-NEXT: } #pragma omp sections { Index: test/OpenMP/cancel_ast_print.cpp =================================================================== --- test/OpenMP/cancel_ast_print.cpp +++ test/OpenMP/cancel_ast_print.cpp @@ -26,7 +26,7 @@ } // CHECK-NEXT: #pragma omp sections // CHECK: { -// CHECK: #pragma omp cancel sections +// CHECK: #pragma omp cancel sections{{$}} // CHECK: } #pragma omp for for (int i = 0; i < argc; ++i) { Index: test/OpenMP/barrier_ast_print.cpp =================================================================== --- test/OpenMP/barrier_ast_print.cpp +++ test/OpenMP/barrier_ast_print.cpp @@ -28,7 +28,7 @@ return a + argc; } // CHECK: static T a; -// CHECK-NEXT: #pragma omp barrier +// CHECK-NEXT: #pragma omp barrier{{$}} // CHECK: static int a; // CHECK-NEXT: #pragma omp barrier // CHECK: static char a; Index: test/OpenMP/atomic_ast_print.cpp =================================================================== --- test/OpenMP/atomic_ast_print.cpp +++ test/OpenMP/atomic_ast_print.cpp @@ -48,7 +48,7 @@ } // CHECK: T a = T(); -// CHECK-NEXT: #pragma omp atomic +// CHECK-NEXT: #pragma omp atomic{{$}} // CHECK-NEXT: a++; // CHECK-NEXT: #pragma omp atomic read // CHECK-NEXT: a = argc; Index: test/Misc/ast-print-pragmas.cpp =================================================================== --- test/Misc/ast-print-pragmas.cpp +++ test/Misc/ast-print-pragmas.cpp @@ -4,7 +4,7 @@ // FIXME: A bug in ParsedAttributes causes the order of the attributes to be // reversed. The checks are consequently in the reverse order below. -// CHECK: #pragma clang loop interleave_count(8) +// CHECK: #pragma clang loop interleave_count(8){{$}} // CHECK-NEXT: #pragma clang loop vectorize_width(4) void test(int *List, int Length) { @@ -61,7 +61,7 @@ #ifdef MS_EXT #pragma init_seg(compiler) -// MS-EXT: #pragma init_seg (.CRT$XCC) +// MS-EXT: #pragma init_seg (.CRT$XCC){{$}} // MS-EXT-NEXT: int x = 3 __declspec(thread); int __declspec(thread) x = 3; #endif //MS_EXT Index: lib/AST/StmtPrinter.cpp =================================================================== --- lib/AST/StmtPrinter.cpp +++ lib/AST/StmtPrinter.cpp @@ -1030,36 +1030,36 @@ for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end(); I != E; ++I) if (*I && !(*I)->isImplicit()) { - Printer.Visit(*I); OS << ' '; + Printer.Visit(*I); } OS << "\n"; if (!ForceNoStmt && S->hasAssociatedStmt()) PrintStmt(S->getInnermostCapturedStmt()->getCapturedStmt()); } void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) { - Indent() << "#pragma omp parallel "; + Indent() << "#pragma omp parallel"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) { - Indent() << "#pragma omp simd "; + Indent() << "#pragma omp simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPForDirective(OMPForDirective *Node) { - Indent() << "#pragma omp for "; + Indent() << "#pragma omp for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPForSimdDirective(OMPForSimdDirective *Node) { - Indent() << "#pragma omp for simd "; + Indent() << "#pragma omp for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPSectionsDirective(OMPSectionsDirective *Node) { - Indent() << "#pragma omp sections "; + Indent() << "#pragma omp sections"; PrintOMPExecutableDirective(Node); } @@ -1069,7 +1069,7 @@ } void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) { - Indent() << "#pragma omp single "; + Indent() << "#pragma omp single"; PrintOMPExecutableDirective(Node); } @@ -1085,29 +1085,28 @@ Node->getDirectiveName().printName(OS); OS << ")"; } - OS << " "; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) { - Indent() << "#pragma omp parallel for "; + Indent() << "#pragma omp parallel for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPParallelForSimdDirective( OMPParallelForSimdDirective *Node) { - Indent() << "#pragma omp parallel for simd "; + Indent() << "#pragma omp parallel for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPParallelSectionsDirective( OMPParallelSectionsDirective *Node) { - Indent() << "#pragma omp parallel sections "; + Indent() << "#pragma omp parallel sections"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) { - Indent() << "#pragma omp task "; + Indent() << "#pragma omp task"; PrintOMPExecutableDirective(Node); } @@ -1127,61 +1126,61 @@ } void StmtPrinter::VisitOMPTaskgroupDirective(OMPTaskgroupDirective *Node) { - Indent() << "#pragma omp taskgroup "; + Indent() << "#pragma omp taskgroup"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPFlushDirective(OMPFlushDirective *Node) { - Indent() << "#pragma omp flush "; + Indent() << "#pragma omp flush"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPOrderedDirective(OMPOrderedDirective *Node) { - Indent() << "#pragma omp ordered "; + Indent() << "#pragma omp ordered"; PrintOMPExecutableDirective(Node, Node->hasClausesOfKind<OMPDependClause>()); } void StmtPrinter::VisitOMPAtomicDirective(OMPAtomicDirective *Node) { - Indent() << "#pragma omp atomic "; + Indent() << "#pragma omp atomic"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetDirective(OMPTargetDirective *Node) { - Indent() << "#pragma omp target "; + Indent() << "#pragma omp target"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetDataDirective(OMPTargetDataDirective *Node) { - Indent() << "#pragma omp target data "; + Indent() << "#pragma omp target data"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetEnterDataDirective( OMPTargetEnterDataDirective *Node) { - Indent() << "#pragma omp target enter data "; + Indent() << "#pragma omp target enter data"; PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true); } void StmtPrinter::VisitOMPTargetExitDataDirective( OMPTargetExitDataDirective *Node) { - Indent() << "#pragma omp target exit data "; + Indent() << "#pragma omp target exit data"; PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true); } void StmtPrinter::VisitOMPTargetParallelDirective( OMPTargetParallelDirective *Node) { - Indent() << "#pragma omp target parallel "; + Indent() << "#pragma omp target parallel"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetParallelForDirective( OMPTargetParallelForDirective *Node) { - Indent() << "#pragma omp target parallel for "; + Indent() << "#pragma omp target parallel for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) { - Indent() << "#pragma omp teams "; + Indent() << "#pragma omp teams"; PrintOMPExecutableDirective(Node); } @@ -1194,111 +1193,111 @@ void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) { Indent() << "#pragma omp cancel " - << getOpenMPDirectiveName(Node->getCancelRegion()) << " "; + << getOpenMPDirectiveName(Node->getCancelRegion()); PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTaskLoopDirective(OMPTaskLoopDirective *Node) { - Indent() << "#pragma omp taskloop "; + Indent() << "#pragma omp taskloop"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTaskLoopSimdDirective( OMPTaskLoopSimdDirective *Node) { - Indent() << "#pragma omp taskloop simd "; + Indent() << "#pragma omp taskloop simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) { - Indent() << "#pragma omp distribute "; + Indent() << "#pragma omp distribute"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetUpdateDirective( OMPTargetUpdateDirective *Node) { - Indent() << "#pragma omp target update "; + Indent() << "#pragma omp target update"; PrintOMPExecutableDirective(Node, /*ForceNoStmt=*/true); } void StmtPrinter::VisitOMPDistributeParallelForDirective( OMPDistributeParallelForDirective *Node) { - Indent() << "#pragma omp distribute parallel for "; + Indent() << "#pragma omp distribute parallel for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPDistributeParallelForSimdDirective( OMPDistributeParallelForSimdDirective *Node) { - Indent() << "#pragma omp distribute parallel for simd "; + Indent() << "#pragma omp distribute parallel for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPDistributeSimdDirective( OMPDistributeSimdDirective *Node) { - Indent() << "#pragma omp distribute simd "; + Indent() << "#pragma omp distribute simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetParallelForSimdDirective( OMPTargetParallelForSimdDirective *Node) { - Indent() << "#pragma omp target parallel for simd "; + Indent() << "#pragma omp target parallel for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetSimdDirective(OMPTargetSimdDirective *Node) { - Indent() << "#pragma omp target simd "; + Indent() << "#pragma omp target simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTeamsDistributeDirective( OMPTeamsDistributeDirective *Node) { - Indent() << "#pragma omp teams distribute "; + Indent() << "#pragma omp teams distribute"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTeamsDistributeSimdDirective( OMPTeamsDistributeSimdDirective *Node) { - Indent() << "#pragma omp teams distribute simd "; + Indent() << "#pragma omp teams distribute simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTeamsDistributeParallelForSimdDirective( OMPTeamsDistributeParallelForSimdDirective *Node) { - Indent() << "#pragma omp teams distribute parallel for simd "; + Indent() << "#pragma omp teams distribute parallel for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTeamsDistributeParallelForDirective( OMPTeamsDistributeParallelForDirective *Node) { - Indent() << "#pragma omp teams distribute parallel for "; + Indent() << "#pragma omp teams distribute parallel for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetTeamsDirective(OMPTargetTeamsDirective *Node) { - Indent() << "#pragma omp target teams "; + Indent() << "#pragma omp target teams"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetTeamsDistributeDirective( OMPTargetTeamsDistributeDirective *Node) { - Indent() << "#pragma omp target teams distribute "; + Indent() << "#pragma omp target teams distribute"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective( OMPTargetTeamsDistributeParallelForDirective *Node) { - Indent() << "#pragma omp target teams distribute parallel for "; + Indent() << "#pragma omp target teams distribute parallel for"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForSimdDirective( OMPTargetTeamsDistributeParallelForSimdDirective *Node) { - Indent() << "#pragma omp target teams distribute parallel for simd "; + Indent() << "#pragma omp target teams distribute parallel for simd"; PrintOMPExecutableDirective(Node); } void StmtPrinter::VisitOMPTargetTeamsDistributeSimdDirective( OMPTargetTeamsDistributeSimdDirective *Node) { - Indent() << "#pragma omp target teams distribute simd "; + Indent() << "#pragma omp target teams distribute simd"; PrintOMPExecutableDirective(Node); } Index: include/clang/Basic/Attr.td =================================================================== --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -2591,7 +2591,7 @@ let Documentation = [InitSegDocs]; let AdditionalMembers = [{ void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const { - OS << '(' << getSection() << ')'; + OS << " (" << getSection() << ')'; } }]; } @@ -2646,12 +2646,12 @@ if (SpellingIndex == Pragma_nounroll) return; else if (SpellingIndex == Pragma_unroll) { - OS << getValueString(Policy); + OS << ' ' << getValueString(Policy); return; } assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling"); - OS << getOptionName(option) << getValueString(Policy); + OS << ' ' << getOptionName(option) << getValueString(Policy); } // Return a string containing the loop hint argument including the @@ -2738,37 +2738,37 @@ void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy) const { if (getBranchState() != BS_Undefined) - OS << ConvertBranchStateTyToStr(getBranchState()) << " "; + OS << ' ' << ConvertBranchStateTyToStr(getBranchState()); if (auto *E = getSimdlen()) { - OS << "simdlen("; + OS << " simdlen("; E->printPretty(OS, nullptr, Policy); - OS << ") "; + OS << ")"; } if (uniforms_size() > 0) { - OS << "uniform"; + OS << " uniform"; StringRef Sep = "("; for (auto *E : uniforms()) { OS << Sep; E->printPretty(OS, nullptr, Policy); Sep = ", "; } - OS << ") "; + OS << ")"; } alignments_iterator NI = alignments_begin(); for (auto *E : aligneds()) { - OS << "aligned("; + OS << " aligned("; E->printPretty(OS, nullptr, Policy); if (*NI) { OS << ": "; (*NI)->printPretty(OS, nullptr, Policy); } - OS << ") "; + OS << ")"; ++NI; } steps_iterator I = steps_begin(); modifiers_iterator MI = modifiers_begin(); for (auto *E : linears()) { - OS << "linear("; + OS << " linear("; if (*MI != OMPC_LINEAR_unknown) OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "("; E->printPretty(OS, nullptr, Policy); @@ -2778,7 +2778,7 @@ OS << ": "; (*I)->printPretty(OS, nullptr, Policy); } - OS << ") "; + OS << ")"; ++I; ++MI; } @@ -2799,7 +2799,7 @@ void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const { // Use fake syntax because it is for testing and debugging purpose only. if (getMapType() != MT_To) - OS << ConvertMapTypeTyToStr(getMapType()) << " "; + OS << ' ' << ConvertMapTypeTyToStr(getMapType()); } }]; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits