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

hfinkel at anl.gov hfinkel at anl.gov
Mon Dec 16 04:47:46 PST 2013


  A few minor comments, otherwise LGTM. Thanks for doing all of the refactoring on this!


================
Comment at: lib/Parse/Parser.cpp:195
@@ +194,3 @@
+    if (NoCount) {
+      SkipUntil(SkipToTok, StopAtSemi | NoBracketsCount);
+    } else {
----------------
Please don't duplicate the call to SkipUntil here. Either make a flags variable:

SkipUntilFlags Flags = StopAtSemi;
if (NoCount)
  Flags |= NoBracketsCount;

or just use StopAtSemi | (NoCount ? NoBracketsCount : 0).


================
Comment at: include/clang/Parse/Parser.h:649
@@ -648,1 +648,3 @@
+  /// If NoCount is true, it ignores parens/brackets/braces as regular tokens
+  /// and does not count them.
   bool ExpectAndConsume(tok::TokenKind ExpectedTok, unsigned Diag,
----------------
Add: The default behavior is to skip balance pairs of parens/brackets/braces.

(maybe nested would be a better word than balanced?)

================
Comment at: include/clang/Parse/Parser.h:757
@@ -754,1 +756,3 @@
+    StopAtCodeCompletion = 1 << 2, ///< Stop at code completion
+    NoBracketsCount = 1 << 3 /// \brief Don't count braces/brackets/parens
   };
----------------
Add: to skip balanced pairs.


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



More information about the cfe-commits mailing list