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

Reply via email to