[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
This revision was automatically updated to reflect the committed changes. Closed by commit rC325145: [OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny (authored by ABataev, committed by ). Repository: rC Clang 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/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: 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)
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
This revision was automatically updated to reflect the committed changes. Closed by commit rL325145: [OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny (authored by ABataev, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D43204?vs=133910=134249#toc Repository: rL LLVM https://reviews.llvm.org/D43204 Files: cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/test/Misc/ast-print-pragmas.cpp cfe/trunk/test/OpenMP/atomic_ast_print.cpp cfe/trunk/test/OpenMP/barrier_ast_print.cpp cfe/trunk/test/OpenMP/cancel_ast_print.cpp cfe/trunk/test/OpenMP/cancellation_point_ast_print.cpp cfe/trunk/test/OpenMP/critical_ast_print.cpp cfe/trunk/test/OpenMP/declare_reduction_ast_print.c cfe/trunk/test/OpenMP/declare_reduction_ast_print.cpp cfe/trunk/test/OpenMP/declare_simd_ast_print.c cfe/trunk/test/OpenMP/declare_simd_ast_print.cpp cfe/trunk/test/OpenMP/declare_target_ast_print.cpp cfe/trunk/test/OpenMP/distribute_ast_print.cpp cfe/trunk/test/OpenMP/distribute_dist_schedule_ast_print.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/flush_ast_print.cpp cfe/trunk/test/OpenMP/for_ast_print.cpp cfe/trunk/test/OpenMP/for_simd_ast_print.cpp cfe/trunk/test/OpenMP/master_ast_print.cpp cfe/trunk/test/OpenMP/ordered_ast_print.cpp cfe/trunk/test/OpenMP/parallel_ast_print.cpp cfe/trunk/test/OpenMP/parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp cfe/trunk/test/OpenMP/sections_ast_print.cpp cfe/trunk/test/OpenMP/simd_ast_print.cpp cfe/trunk/test/OpenMP/single_ast_print.cpp cfe/trunk/test/OpenMP/target_ast_print.cpp cfe/trunk/test/OpenMP/target_data_ast_print.cpp cfe/trunk/test/OpenMP/target_data_use_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_enter_data_ast_print.cpp cfe/trunk/test/OpenMP/target_exit_data_ast_print.cpp cfe/trunk/test/OpenMP/target_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_teams_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_update_ast_print.cpp cfe/trunk/test/OpenMP/task_ast_print.cpp cfe/trunk/test/OpenMP/taskgroup_ast_print.cpp cfe/trunk/test/OpenMP/taskloop_ast_print.cpp cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp cfe/trunk/test/OpenMP/taskwait_ast_print.cpp cfe/trunk/test/OpenMP/taskyield_ast_print.cpp cfe/trunk/test/OpenMP/teams_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp cfe/trunk/test/OpenMP/teams_distribute_simd_ast_print.cpp cfe/trunk/test/OpenMP/threadprivate_ast_print.cpp cfe/trunk/test/PCH/pragma-loop.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp === --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp +++ cfe/trunk/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: cfe/trunk/lib/AST/StmtPrinter.cpp === --- cfe/trunk/lib/AST/StmtPrinter.cpp +++ cfe/trunk/lib/AST/StmtPrinter.cpp @@ -1030,36 +1030,36 @@ for (ArrayRef::iterator I = Clauses.begin(), E = Clauses.end(); I != E; ++I) if (*I && !(*I)->isImplicit()) { - Printer.Visit(*I); OS << ' '; + Printer.Visit(*I); } OS
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
jdenny added a comment. In https://reviews.llvm.org/D43204#1007502, @ABataev wrote: > LG Alexey: Thanks for accepting. I do not have commit privileges. Would you please commit for me? https://reviews.llvm.org/D43204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG https://reviews.llvm.org/D43204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43204: [OpenMP] Fix trailing space when printing pragmas
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 @@ //