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

Richard legalize at xmission.com
Mon Mar 23 22:20:09 PDT 2015


================
Comment at: lib/AST/ASTContext.cpp:8002-8003
@@ -8001,6 +8001,4 @@
       return false;
-  } else if (isa<OMPThreadPrivateDecl>(D))
-    return true;
-  else
-    return false;
+  } else
+    return isa<OMPThreadPrivateDecl>(D);
 
----------------
majnemer wrote:
> There should be braces around the return to match the braces in the blocks.
Fixed and run through `clang-format`

================
Comment at: lib/AST/DeclBase.cpp:494-496
@@ -493,10 +493,5 @@
   // 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();
 }
----------------
majnemer wrote:
> Please put braces around this.
Fixed and run through `clang-format`

http://reviews.llvm.org/D8532

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list