[clang] [alpha.webkit.UncheckedLambdaCapturesChecker] Split unchecked lambda capture checker (PR #201044)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 6 14:07:02 PDT 2026


================
@@ -0,0 +1,713 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedLambdaCapturesChecker -verify %s
+
+#include "mock-types.h"
+
+namespace std {
+
+template <typename T>
+T&& move(T& t) {
+  return static_cast<T&&>(t);
+}
+
+namespace ranges {
+
+template<typename IteratorType, typename CallbackType>
+void for_each(IteratorType first, IteratorType last, CallbackType callback) {
+  for (auto it = first; !(it == last); ++it)
+    callback(*it);
+}
+
+struct all_of_impl {
+  template <typename Collection, typename Predicate>
+  constexpr bool operator()(const Collection& collection, Predicate predicate) const {
+    for (auto it = collection.begin(); it != collection.end(); ++it) {
+      if (!predicate(*it))
+        return false;
+    }
+    return true;
+  }
+};
+inline constexpr auto all_of = all_of_impl {};
----------------
rniwa wrote:

Sure, fixed.

https://github.com/llvm/llvm-project/pull/201044


More information about the cfe-commits mailing list