[PATCH] D10017: Refactor: Simplify boolean conditional return statements in lib/Lex

Richard via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 24 12:56:15 PDT 2015


LegalizeAdulthood updated this revision to Diff 38322.
LegalizeAdulthood added a comment.

Update to latest.
I do not have commit access.


http://reviews.llvm.org/D10017

Files:
  lib/Lex/PPDirectives.cpp
  lib/Lex/PPMacroExpansion.cpp

Index: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -597,9 +597,7 @@
       Brackets.pop_back();
     }
   }
-  if (!Brackets.empty())
-    return false;
-  return true;
+  return Brackets.empty();
 }
 
 /// GenerateNewArgTokens - Returns true if OldTokens can be converted to a new
Index: lib/Lex/PPDirectives.cpp
===================================================================
--- lib/Lex/PPDirectives.cpp
+++ lib/Lex/PPDirectives.cpp
@@ -2045,13 +2045,9 @@
   }
 
   // #define inline
-  if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
-                        tok::kw_const) &&
-      MI->getNumTokens() == 0) {
-    return true;
-  }
-
-  return false;
+  return MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
+                           tok::kw_const) &&
+         MI->getNumTokens() == 0;
 }
 
 /// HandleDefineDirective - Implements \#define.  This consumes the entire macro


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10017.38322.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151024/b9e5cc28/attachment.bin>


More information about the cfe-commits mailing list