[PATCH] Refactor: Simplify boolean expressions in lib/AST

Richard legalize at xmission.com
Sun Mar 22 13:40:40 PDT 2015


Hi alexfh, doug.gregor, rsmith, rjmccall, akyrtzi, eli.friedman,

Simplify boolean expressions using `true` and `false` with `clang-tidy`

http://reviews.llvm.org/D8532

Files:
  lib/AST/ASTContext.cpp
  lib/AST/DeclBase.cpp

Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -7999,10 +7999,8 @@
     // We never need to emit an uninstantiated function template.
     if (FD->getTemplatedKind() == FunctionDecl::TK_FunctionTemplate)
       return false;
-  } else if (isa<OMPThreadPrivateDecl>(D))
-    return true;
-  else
-    return false;
+  } else
+    return isa<OMPThreadPrivateDecl>(D);
 
   // If this is a member of a class template, we do not need to emit it.
   if (D->getDeclContext()->isDependentContext())
Index: lib/AST/DeclBase.cpp
===================================================================
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -491,14 +491,9 @@
     return true;
 
   // Objective-C classes, if this is the non-fragile runtime.
-  } else if (isa<ObjCInterfaceDecl>(this) &&
-             getASTContext().getLangOpts().ObjCRuntime.hasWeakClassImport()) {
-    return true;
-
-  // Nothing else.
-  } else {
-    return false;
-  }
+  } else
+    return isa<ObjCInterfaceDecl>(this) &&
+             getASTContext().getLangOpts().ObjCRuntime.hasWeakClassImport();
 }
 
 bool Decl::isWeakImported() const {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8532.22442.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150322/ffb4cf59/attachment.bin>


More information about the cfe-commits mailing list