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

David Blaikie dblaikie at gmail.com
Sun Mar 8 16:56:36 PDT 2015


Looks good to me, please commit (after dropping parens)


================
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));
     }
----------------
Drop the extra parens

================
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));
 }
----------------
Drop the extra parens

================
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);
         }
----------------
Drop extra parens

http://reviews.llvm.org/D8155

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






More information about the cfe-commits mailing list