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

Richard legalize at xmission.com
Mon May 25 13:59:32 PDT 2015


Use clang-tidy to simplify boolean conditional return statements

http://reviews.llvm.org/D10016

Files:
  lib/Frontend/Rewrite/RewriteMacros.cpp
  lib/Frontend/VerifyDiagnosticConsumer.cpp

Index: lib/Frontend/Rewrite/RewriteMacros.cpp
===================================================================
--- lib/Frontend/Rewrite/RewriteMacros.cpp
+++ lib/Frontend/Rewrite/RewriteMacros.cpp
@@ -35,11 +35,8 @@
   // Otherwise, if they are different but have the same identifier info, they
   // are also considered to be the same.  This allows keywords and raw lexed
   // identifiers with the same name to be treated the same.
-  if (PPTok.getIdentifierInfo() &&
-      PPTok.getIdentifierInfo() == RawTok.getIdentifierInfo())
-    return true;
-
-  return false;
+  return PPTok.getIdentifierInfo() &&
+         PPTok.getIdentifierInfo() == RawTok.getIdentifierInfo();
 }
 
 
Index: lib/Frontend/VerifyDiagnosticConsumer.cpp
===================================================================
--- lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -186,9 +186,7 @@
       Regex(RegexStr) { }
 
   bool isValid(std::string &Error) override {
-    if (Regex.isValid(Error))
-      return true;
-    return false;
+    return Regex.isValid(Error);
   }
 
   bool match(StringRef S) override {

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


More information about the cfe-commits mailing list