[PATCH] [OPENMP] Fix for parsing OpenMP directives with extra braces, brackets and parens

hfinkel at anl.gov hfinkel at anl.gov
Mon Nov 4 14:58:04 PST 2013



================
Comment at: include/clang/Parse/Parser.h:638
@@ -637,3 +637,3 @@
   /// SkipToTok is specified, it calls SkipUntil(SkipToTok).  Finally, true is
   /// returned.
   bool ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned Diag,
----------------
Please describe what NoCount does here.

================
Comment at: include/clang/Parse/Parser.h:746
@@ -744,3 +745,3 @@
   /// If SkipUntil finds the specified token, it returns true, otherwise it
   /// returns false.
   bool SkipUntil(tok::TokenKind T, bool StopAtSemi = true,
----------------
And also describe NoCount here (as with the other parameters).

================
Comment at: lib/Parse/ParseOpenMP.cpp:181
@@ -179,2 +180,3 @@
+    SkipUntil(tok::annot_pragma_openmp_end, false, false, false, true);
     break;
   }
----------------
This is not your fault, but these boolean parameters are becoming increasingly difficult to read.  I'm afraid that adding one more may push this over the limit into problems. I'd prefer that, before making this change, we change the current code to use some bit values that can be or'd together.

================
Comment at: test/OpenMP/threadprivate_messages.cpp:28
@@ +27,3 @@
+#pragma omp threadprivate (a) ( // expected-error {{'#pragma omp threadprivate' must precede all references to variable 'a'}} expected-warning {{extra tokens at the end of '#pragma omp threadprivate' are ignored}}
+#pragma omp threadprivate (a) [ // expected-error {{'#pragma omp threadprivate' must precede all references to variable 'a'}} expected-warning {{extra tokens at the end of '#pragma omp threadprivate' are ignored}}
+#pragma omp threadprivate (a) { // expected-error {{'#pragma omp threadprivate' must precede all references to variable 'a'}} expected-warning {{extra tokens at the end of '#pragma omp threadprivate' are ignored}}
----------------
I don't understand why there is both an error and a warning here. Can we get rid of the 'extra tokens' warning? That's misleading because the syntax is fine, the error is semantic.


http://llvm-reviews.chandlerc.com/D1847



More information about the cfe-commits mailing list