[PATCH] Refactor: Simplify boolean conditional return statements in lib/Transforms/Instrumentation

Richard legalize at xmission.com
Mon May 25 10:38:33 PDT 2015


Hi kcc, eugenis, nicholas, void, chandlerc, pcc, samsonov,

Use clang-tidy to simplify boolean conditional return statements.

http://reviews.llvm.org/D9996

Files:
  lib/Transforms/Instrumentation/AddressSanitizer.cpp
  lib/Transforms/Instrumentation/ThreadSanitizer.cpp

Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -884,10 +884,8 @@
   } else {
     return false;
   }
-  if (!isPointerOperand(I->getOperand(0)) ||
-      !isPointerOperand(I->getOperand(1)))
-    return false;
-  return true;
+  return isPointerOperand(I->getOperand(0)) &&
+         isPointerOperand(I->getOperand(1));
 }
 
 bool AddressSanitizer::GlobalIsLinkerInitialized(GlobalVariable *G) {
Index: lib/Transforms/Instrumentation/ThreadSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/ThreadSanitizer.cpp
+++ lib/Transforms/Instrumentation/ThreadSanitizer.cpp
@@ -326,9 +326,7 @@
     return true;
   if (isa<AtomicCmpXchgInst>(I))
     return true;
-  if (isa<FenceInst>(I))
-    return true;
-  return false;
+  return isa<FenceInst>(I);
 }
 
 bool ThreadSanitizer::runOnFunction(Function &F) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9996.26460.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150525/3da52ceb/attachment.bin>


More information about the llvm-commits mailing list