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

Alexey Bataev a.bataev at hotmail.com
Tue Dec 17 02:25:41 PST 2013



================
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,
----------------
hfinkel at anl.gov wrote:
> Add: The default behavior is to skip balance pairs of parens/brackets/braces.
> 
> (maybe nested would be a better word than balanced?)
Ok.

================
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
   };
----------------
hfinkel at anl.gov wrote:
> Add: to skip balanced pairs.
Ok

================
Comment at: lib/Parse/Parser.cpp:195
@@ +194,3 @@
+    if (NoCount) {
+      SkipUntil(SkipToTok, StopAtSemi | NoBracketsCount);
+    } else {
----------------
hfinkel at anl.gov wrote:
> 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).
> 
Ok, I'll fix it.


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



More information about the cfe-commits mailing list