From a67a4d2f3c07bd589d395a5815dea2198a261162 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 10 Nov 2016 08:49:37 +0000 Subject: Make output of -ast-print a valid C++ code. Output generated by option -ast-print looks like C/C++ code, and it really is for plain C. For C++ the produced output was not valid C++ code, but the differences were small. With this change the output is fixed and can be compiled. Tests are changed so that output produced by -ast-print is compiled again with the same flags and both outputs are compared. Option -ast-print is extensively used in clang tests but it itself was tested poorly, existing tests only checked that compiler did not crash. There are unit tests in file DeclPrinterTest.cpp, but they test only terse output mode. Differential Revision: https://reviews.llvm.org/D26452 llvm-svn: 286439 --- clang/test/OpenMP/parallel_sections_ast_print.cpp | 48 +++++++++++------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'clang/test/OpenMP/parallel_sections_ast_print.cpp') diff --git a/clang/test/OpenMP/parallel_sections_ast_print.cpp b/clang/test/OpenMP/parallel_sections_ast_print.cpp index a66b75ea6d7..4c298df96bd 100644 --- a/clang/test/OpenMP/parallel_sections_ast_print.cpp +++ b/clang/test/OpenMP/parallel_sections_ast_print.cpp @@ -15,18 +15,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static long TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -50,55 +50,55 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int b = argc, c, d, e, f, g; -// CHECK-NEXT: static int a; -// CHECK-NEXT: S s; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK: template long tmain(long argc, long *argv) { -// CHECK-NEXT: long b = argc, c, d, e, f, g; -// CHECK-NEXT: static long a; -// CHECK-NEXT: S s; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int b = argc, c, d, e, f, g; +// CHECK-NEXT: static int a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T a; -// CHECK-NEXT: S s; +// CHECK: template<> long tmain(long argc, long *argv) { +// CHECK-NEXT: long b = argc, c, d, e, f, g; +// CHECK-NEXT: static long a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section -- cgit v1.2.3