[PATCH] Refactor: simplify boolean conditional return statements in lib/Analysis

Richard legalize at xmission.com
Mon May 25 12:26:44 PDT 2015


Hi krememek, delesley, doug.gregor, aaron.ballman, bkramer, jordan_rose, hans, ddunbar,

Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D10008

Files:
  lib/Analysis/BodyFarm.cpp

Index: lib/Analysis/BodyFarm.cpp
===================================================================
--- lib/Analysis/BodyFarm.cpp
+++ lib/Analysis/BodyFarm.cpp
@@ -36,10 +36,7 @@
   // returns void.
   const FunctionProtoType *FT =
   BPT->getPointeeType()->getAs<FunctionProtoType>();
-  if (!FT || !FT->getReturnType()->isVoidType() || FT->getNumParams() != 0)
-    return false;
-
-  return true;
+  return FT && FT->getReturnType()->isVoidType() && FT->getNumParams() == 0;
 }
 
 namespace {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10008.26474.patch
Type: text/x-patch
Size: 497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150525/400ce318/attachment.bin>


More information about the cfe-commits mailing list