Hi alexfh, doug.gregor, rsmith, akyrtzi, rjmccall, CornedBee,

Simplify boolean expressions using `true` and `false` with `clang-tidy`

http://reviews.llvm.org/D8530

Files:
  lib/Parse/ParseDecl.cpp

Index: lib/Parse/ParseDecl.cpp
===================================================================
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -5187,18 +5187,15 @@
     // If this can't be an abstract-declarator, this *must* be a grouping
     // paren, because we haven't seen the identifier yet.
     isGrouping = true;
-  } else if (Tok.is(tok::r_paren) ||           // 'int()' is a function.
-             (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis) &&
-              NextToken().is(tok::r_paren)) || // C++ int(...)
-             isDeclarationSpecifier() ||       // 'int(int)' is a function.
-             isCXX11AttributeSpecifier()) {    // 'int([[]]int)' is a function.
+  } else
     // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is
     // considered to be a type, not a K&R identifier-list.
-    isGrouping = false;
-  } else {
     // Otherwise, this is a grouping paren, e.g. 'int (*X)' or 'int(X)'.
-    isGrouping = true;
-  }
+    isGrouping = !(Tok.is(tok::r_paren) || // 'int()' is a function.
+                   (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis) &&
+                    NextToken().is(tok::r_paren)) || // C++ int(...)
+                   isDeclarationSpecifier() || // 'int(int)' is a function.
+                   isCXX11AttributeSpecifier());
 
   // If this is a grouping paren, handle:
   // direct-declarator: '(' declarator ')'

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Parse/ParseDecl.cpp
===================================================================
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -5187,18 +5187,15 @@
     // If this can't be an abstract-declarator, this *must* be a grouping
     // paren, because we haven't seen the identifier yet.
     isGrouping = true;
-  } else if (Tok.is(tok::r_paren) ||           // 'int()' is a function.
-             (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis) &&
-              NextToken().is(tok::r_paren)) || // C++ int(...)
-             isDeclarationSpecifier() ||       // 'int(int)' is a function.
-             isCXX11AttributeSpecifier()) {    // 'int([[]]int)' is a function.
+  } else
     // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is
     // considered to be a type, not a K&R identifier-list.
-    isGrouping = false;
-  } else {
     // Otherwise, this is a grouping paren, e.g. 'int (*X)' or 'int(X)'.
-    isGrouping = true;
-  }
+    isGrouping = !(Tok.is(tok::r_paren) || // 'int()' is a function.
+                   (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis) &&
+                    NextToken().is(tok::r_paren)) || // C++ int(...)
+                   isDeclarationSpecifier() || // 'int(int)' is a function.
+                   isCXX11AttributeSpecifier());
 
   // If this is a grouping paren, handle:
   // direct-declarator: '(' declarator ')'
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to