r294504 - [Lit Test] Make tests C++11 compatible - Parse OpenMP
Charles Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 8 11:46:15 PST 2017
Author: lcharles
Date: Wed Feb 8 13:46:15 2017
New Revision: 294504
URL: http://llvm.org/viewvc/llvm-project?rev=294504&view=rev
Log:
[Lit Test] Make tests C++11 compatible - Parse OpenMP
Differential Revision: https://reviews.llvm.org/D29725
Modified:
cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
cfe/trunk/test/OpenMP/openmp_check.cpp
Modified: cfe/trunk/test/OpenMP/declare_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_reduction_messages.cpp?rev=294504&r1=294503&r2=294504&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/declare_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/declare_reduction_messages.cpp Wed Feb 8 13:46:15 2017
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
int temp; // expected-note 7 {{'temp' declared here}}
@@ -51,7 +53,17 @@ class Class2 : public Class1<T> {
#pragma omp declare reduction(fun222 : long : omp_out += omp_in) // expected-error {{redefinition of user-defined reduction for type 'long'}}
#pragma omp declare reduction(fun1 : long : omp_out += omp_in) initializer // expected-error {{expected '(' after 'initializer'}}
#pragma omp declare reduction(fun2 : long : omp_out += omp_in) initializer { // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
-#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[ // expected-error {{expected '(' after 'initializer'}} expected-error {{expected expression}} expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
+#pragma omp declare reduction(fun3 : long : omp_out += omp_in) initializer[
+#if __cplusplus <= 199711L
+// expected-error at -2 {{expected '(' after 'initializer'}}
+// expected-error at -3 {{expected expression}}
+// expected-warning at -4 {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
+#else
+// expected-error at -6 {{expected '(' after 'initializer'}}
+// expected-error at -7 {{expected variable name or 'this' in lambda capture list}}
+// expected-error at -8 {{expected ')'}}
+// expected-note at -9 {{to match this '('}}
+#endif
#pragma omp declare reduction(fun4 : long : omp_out += omp_in) initializer() // expected-error {{expected expression}}
#pragma omp declare reduction(fun5 : long : omp_out += omp_in) initializer(temp) // expected-error {{only 'omp_priv' or 'omp_orig' variables are allowed in initializer expression}}
#pragma omp declare reduction(fun6 : long : omp_out += omp_in) initializer(omp_orig // expected-error {{expected ')'}} expected-note {{to match this '('}}
Modified: cfe/trunk/test/OpenMP/openmp_check.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/openmp_check.cpp?rev=294504&r1=294503&r2=294504&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/openmp_check.cpp (original)
+++ cfe/trunk/test/OpenMP/openmp_check.cpp Wed Feb 8 13:46:15 2017
@@ -1,15 +1,35 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s
+
int nested(int a) {
#pragma omp parallel
++a;
- auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}}
+ auto F = [&]() {
+#if __cplusplus <= 199711L
+ // expected-warning at -2 {{'auto' type specifier is a C++11 extension}}
+ // expected-error at -3 {{expected expression}}
+ // expected-error at -4 {{expected ';' at end of declaration}}
+#else
+ // expected-no-diagnostics
+#endif
+
#pragma omp parallel
{
#pragma omp target
++a;
}
};
- F(); // expected-error {{C++ requires a type specifier for all declarations}}
- return a; // expected-error {{expected unqualified-id}}
-}// expected-error {{extraneous closing brace ('}')}}
+ F();
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{C++ requires a type specifier for all declarations}}
+#endif
+ return a;
+#if __cplusplus <= 199711L
+ // expected-error at -2 {{expected unqualified-id}}
+#endif
+}
+#if __cplusplus <= 199711L
+// expected-error at -2 {{extraneous closing brace ('}')}}
+#endif
More information about the cfe-commits
mailing list