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

Saleem Abdulrasool abdulras at fb.com
Fri Jun 5 11:37:51 PDT 2015


================
Comment at: lib/MC/MCSymbol.cpp:20
@@ -19,3 +19,3 @@
 static bool isAcceptableChar(char C) {
-  if ((C < 'a' || C > 'z') &&
+  return !((C < 'a' || C > 'z') &&
       (C < 'A' || C > 'Z') &&
----------------
Push the negate through?

================
Comment at: lib/MC/MachObjectWriter.cpp:49
@@ -48,7 +48,3 @@
   // definition may not always be the one in the same object file.
-  if (S.getData().getFlags() & SF_WeakDefinition)
-    return true;
-
-  // Otherwise, we can use an internal relocation.
-  return false;
+  return S.getData().getFlags() & SF_WeakDefinition;
 }
----------------
I think that the comment should be retained and merged here.

================
Comment at: lib/MC/MachObjectWriter.cpp:695
@@ -698,3 +694,3 @@
     if (!hasReliableSymbolDifference) {
-      if (!SA.isInSection() || &SecA != &SecB ||
+      return !(!SA.isInSection() || &SecA != &SecB ||
           (!SA.isTemporary() &&
----------------
Push the negate through?

http://reviews.llvm.org/D9976

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






More information about the llvm-commits mailing list