[clang] 40ef427 - get rid of the NDEBUG usage in RecoveryExpr, NFC.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue May 12 01:20:28 PDT 2020


Author: Haojian Wu
Date: 2020-05-12T10:19:58+02:00
New Revision: 40ef4274600316ed12a26a73265cf34432e1fbf7

URL: https://github.com/llvm/llvm-project/commit/40ef4274600316ed12a26a73265cf34432e1fbf7
DIFF: https://github.com/llvm/llvm-project/commit/40ef4274600316ed12a26a73265cf34432e1fbf7.diff

LOG: get rid of the NDEBUG usage in RecoveryExpr, NFC.

use the llvm::all_of, per dblaikie's suggestion.

Added: 
    

Modified: 
    clang/lib/AST/Expr.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 8b327300fb2d..858f39f0bae0 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4686,10 +4686,7 @@ RecoveryExpr::RecoveryExpr(ASTContext &Ctx, QualType T, SourceLocation BeginLoc,
     : Expr(RecoveryExprClass, T, VK_LValue, OK_Ordinary), BeginLoc(BeginLoc),
       EndLoc(EndLoc), NumExprs(SubExprs.size()) {
   assert(!T.isNull());
-#ifndef NDEBUG // avoid -Wunused warnings.
-  for (auto *E : SubExprs)
-    assert(E != nullptr);
-#endif
+  assert(llvm::all_of(SubExprs, [](Expr* E) { return E != nullptr; }));
 
   llvm::copy(SubExprs, getTrailingObjects<Expr *>());
   setDependence(computeDependence(this));


        


More information about the cfe-commits mailing list