r202942 - [OPENMP] emit error message for clause 'if(1 0)'

Alexey Bataev a.bataev at hotmail.com
Tue Mar 4 22:53:14 PST 2014


Author: abataev
Date: Wed Mar  5 00:53:13 2014
New Revision: 202942

URL: http://llvm.org/viewvc/llvm-project?rev=202942&view=rev
Log:
[OPENMP] emit error message for clause 'if(1 0)'

Modified:
    cfe/trunk/lib/Parse/ParseOpenMP.cpp
    cfe/trunk/test/OpenMP/parallel_if_messages.cpp

Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=202942&r1=202941&r2=202942&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Wed Mar  5 00:53:13 2014
@@ -330,10 +330,6 @@ OMPClause *Parser::ParseOpenMPSingleExpr
   ExprResult LHS(ParseCastExpression(false, false, NotTypeCast));
   ExprResult Val(ParseRHSOfBinaryExpression(LHS, prec::Conditional));
 
-  if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::comma) &&
-      Tok.isNot(tok::annot_pragma_openmp_end))
-    ConsumeAnyToken();
-
   // Parse ')'.
   T.consumeClose();
 

Modified: cfe/trunk/test/OpenMP/parallel_if_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_if_messages.cpp?rev=202942&r1=202941&r2=202942&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_if_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_if_messages.cpp Wed Mar  5 00:53:13 2014
@@ -20,6 +20,7 @@ int tmain(T argc, S **argv) {
   #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}}
   #pragma omp parallel if (S) // expected-error {{'S' does not refer to a value}}
   #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
   #pragma omp parallel if(argc)
   foo();
 
@@ -36,6 +37,8 @@ int main(int argc, char **argv) {
   #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}}
   #pragma omp parallel if (S1) // expected-error {{'S1' does not refer to a value}}
   #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
+  #pragma omp parallel if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
   #pragma omp parallel if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
   foo();
 





More information about the cfe-commits mailing list