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

Richard legalize at xmission.com
Mon May 25 14:31:02 PDT 2015


Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D10020

Files:
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp

Index: lib/Serialization/ASTReader.cpp
===================================================================
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -3817,10 +3817,7 @@
         
     case llvm::BitstreamEntry::SubBlock:
       if (Entry.ID == BlockID) {
-        if (Cursor.EnterSubBlock(BlockID))
-          return true;
-        // Found it!
-        return false;
+        return Cursor.EnterSubBlock(BlockID);
       }
       
       if (Cursor.SkipBlock())
Index: lib/Serialization/ASTWriter.cpp
===================================================================
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -3096,15 +3096,9 @@
   /// doesn't check whether the name has macros defined; use PublicMacroIterator
   /// to check that.
   bool isInterestingIdentifier(IdentifierInfo *II, uint64_t MacroOffset) {
-    if (MacroOffset ||
-        II->isPoisoned() ||
-        II->isExtensionToken() ||
-        II->getObjCOrBuiltinID() ||
-        II->hasRevertedTokenIDToIdentifier() ||
-        II->getFETokenInfo<void>())
-      return true;
-
-    return false;
+    return MacroOffset || II->isPoisoned() || II->isExtensionToken() ||
+           II->getObjCOrBuiltinID() || II->hasRevertedTokenIDToIdentifier() ||
+           II->getFETokenInfo<void>();
   }
 
 public:

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


More information about the cfe-commits mailing list