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

Richard legalize at xmission.com
Mon Mar 23 22:21:49 PDT 2015


Added braces and run through `clang-format`


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,9 @@
     // 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,13 +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;
+    return isa<ObjCInterfaceDecl>(this) &&
+           getASTContext().getLangOpts().ObjCRuntime.hasWeakClassImport();
   }
 }

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


More information about the cfe-commits mailing list