[PATCH] Refactor: Simplify boolean conditional return statements in llvm/lib/Support

Richard legalize at xmission.com
Mon May 25 08:41:55 PDT 2015


clang-format


http://reviews.llvm.org/D9978

Files:
  lib/Support/CommandLine.cpp
  lib/Support/LineIterator.cpp
  lib/Support/YAMLParser.cpp

Index: lib/Support/CommandLine.cpp
===================================================================
--- lib/Support/CommandLine.cpp
+++ lib/Support/CommandLine.cpp
@@ -346,10 +346,7 @@
     Value = Val;
   }
 
-  if (Handler->addOccurrence(pos, ArgName, Value, MultiArg))
-    return true;
-
-  return false;
+  return Handler->addOccurrence(pos, ArgName, Value, MultiArg);
 }
 
 /// ProvideOption - For Value, this differentiates between an empty value ("")
Index: lib/Support/LineIterator.cpp
===================================================================
--- lib/Support/LineIterator.cpp
+++ lib/Support/LineIterator.cpp
@@ -15,9 +15,7 @@
 static bool isAtLineEnd(const char *P) {
   if (*P == '\n')
     return true;
-  if (*P == '\r' && *(P + 1) == '\n')
-    return true;
-  return false;
+  return *P == '\r' && *(P + 1) == '\n';
 }
 
 static bool skipIfAtLineEnd(const char *&P) {
Index: lib/Support/YAMLParser.cpp
===================================================================
--- lib/Support/YAMLParser.cpp
+++ lib/Support/YAMLParser.cpp
@@ -962,10 +962,8 @@
 bool Scanner::isBlankOrBreak(StringRef::iterator Position) {
   if (Position == End)
     return false;
-  if (   *Position == ' ' || *Position == '\t'
-      || *Position == '\r' || *Position == '\n')
-    return true;
-  return false;
+  return *Position == ' ' || *Position == '\t' || *Position == '\r' ||
+         *Position == '\n';
 }
 
 bool Scanner::consumeLineBreakIfPresent() {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9978.26441.patch
Type: text/x-patch
Size: 1471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/9526f9f8/attachment.bin>


More information about the llvm-commits mailing list