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/
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 {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to