[PATCH] D105101: [analyzer] Make CheckerManager::hasPathSensitiveCheckers() complete again

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 29 07:24:50 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3dae01911b69: [analyzer] Make CheckerManager::hasPathSensitiveCheckers() complete again (authored by steakhal).

Changed prior to commit:
  https://reviews.llvm.org/D105101?vs=355179&id=355227#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105101/new/

https://reviews.llvm.org/D105101

Files:
  clang/lib/StaticAnalyzer/Core/CheckerManager.cpp


Index: clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -33,21 +33,20 @@
 using namespace ento;
 
 bool CheckerManager::hasPathSensitiveCheckers() const {
-  return !StmtCheckers.empty()              ||
-         !PreObjCMessageCheckers.empty()    ||
-         !PostObjCMessageCheckers.empty()   ||
-         !PreCallCheckers.empty()    ||
-         !PostCallCheckers.empty()   ||
-         !LocationCheckers.empty()          ||
-         !BindCheckers.empty()              ||
-         !EndAnalysisCheckers.empty()       ||
-         !EndFunctionCheckers.empty()           ||
-         !BranchConditionCheckers.empty()   ||
-         !LiveSymbolsCheckers.empty()       ||
-         !DeadSymbolsCheckers.empty()       ||
-         !RegionChangesCheckers.empty()     ||
-         !EvalAssumeCheckers.empty()        ||
-         !EvalCallCheckers.empty();
+  const auto IfAnyAreNonEmpty = [](const auto &... Callbacks) -> bool {
+    bool Result = false;
+    // FIXME: Use fold expressions in C++17.
+    LLVM_ATTRIBUTE_UNUSED int Unused[]{0, (Result |= !Callbacks.empty())...};
+    return Result;
+  };
+  return IfAnyAreNonEmpty(
+      StmtCheckers, PreObjCMessageCheckers, ObjCMessageNilCheckers,
+      PostObjCMessageCheckers, PreCallCheckers, PostCallCheckers,
+      LocationCheckers, BindCheckers, EndAnalysisCheckers,
+      BeginFunctionCheckers, EndFunctionCheckers, BranchConditionCheckers,
+      NewAllocatorCheckers, LiveSymbolsCheckers, DeadSymbolsCheckers,
+      RegionChangesCheckers, PointerEscapeCheckers, EvalAssumeCheckers,
+      EvalCallCheckers, EndOfTranslationUnitCheckers);
 }
 
 void CheckerManager::finishedCheckerRegistration() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105101.355227.patch
Type: text/x-patch
Size: 1840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210629/45742b30/attachment.bin>


More information about the cfe-commits mailing list