cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
128 lines
2.6 KiB
C++
128 lines
2.6 KiB
C++
// RUN: %clang_analyze_cc1 -std=c++20 -analyzer-checker=core,debug.ExprInspection -analyzer-config inline-lambdas=true -verify %s
|
|
|
|
#include "Inputs/system-header-simulator-cxx.h"
|
|
void clang_analyzer_warnIfReached();
|
|
void clang_analyzer_eval(int);
|
|
|
|
void capture_structured_binding_to_array_byref() {
|
|
int arr[] {5};
|
|
auto& [i] = arr;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
void capture_structured_binding_to_array_byvalue() {
|
|
int arr[] {5};
|
|
auto [i] = arr;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
void capture_structured_binding_to_tuple_like_byref() {
|
|
std::pair<int, int> p {5, 6};
|
|
auto& [i, _] = p;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
void capture_structured_binding_to_tuple_like_byvalue() {
|
|
std::pair<int, int> p {5, 6};
|
|
auto [i, _] = p;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
struct S { int x; };
|
|
|
|
void capture_structured_binding_to_data_member_byref() {
|
|
S s{5};
|
|
auto& [i] = s;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|
|
|
|
void capture_structured_binding_to_data_member_byvalue() {
|
|
S s{5};
|
|
auto [i] = s;
|
|
[i]() mutable {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
++i;
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
}();
|
|
[&i] {
|
|
if (i != 5)
|
|
clang_analyzer_warnIfReached();
|
|
i++;
|
|
}();
|
|
clang_analyzer_eval(i == 6); // expected-warning{{TRUE}}
|
|
}
|