[PATCH] Refactor: Simplify boolean expressions in clang with clang-tidy

Richard legalize at xmission.com
Sun Mar 8 18:29:12 PDT 2015


================
Comment at: lib/Driver/ToolChain.cpp:300
@@ -299,6 +299,3 @@
                                  options::OPT_mbig_endian)) {
-      if (A->getOption().matches(options::OPT_mlittle_endian))
-        IsBigEndian = false;
-      else
-        IsBigEndian = true;
+      IsBigEndian = !(A->getOption().matches(options::OPT_mlittle_endian));
     }
----------------
dblaikie wrote:
> Drop the extra parens
Fixed

================
Comment at: lib/Lex/PreprocessingRecord.cpp:77
@@ -76,6 +76,3 @@
   
-  if (SM.isInFileID(SM.getFileLoc(Loc), FID))
-    return true;
-  else
-    return false;
+  return (SM.isInFileID(SM.getFileLoc(Loc), FID));
 }
----------------
dblaikie wrote:
> Drop the extra parens
Fixed

================
Comment at: lib/Sema/SemaOverload.cpp:9500
@@ -9499,6 +9499,3 @@
         if (numLFixes != numRFixes) {
-          if (numLFixes < numRFixes)
-            return true;
-          else
-            return false;
+          return (numLFixes < numRFixes);
         }
----------------
dblaikie wrote:
> Drop extra parens
Fixed

http://reviews.llvm.org/D8155

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list