Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/Analysis/cxx11-crashes.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
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).
2026-08-01 05:13:02 +03:00

95 lines
2.0 KiB
C++

// RUN: %clang_analyze_cc1 -analyzer-checker=core -std=c++11 -verify %s
// PR12871
class PlotPoint {
bool valid;
};
PlotPoint limitedFit () {
PlotPoint fit0;
fit0 = limitedFit ();
return fit0;
}
namespace boost {namespace filesystem3 {
class path {
public:
path(){}
};
}}
namespace boost
{
namespace filesystem
{
using filesystem3::path;
}
}
void radar11487541() {
namespace fs = boost::filesystem;
fs::path p;
}
// PR12873
void testFloatInitializer() {
const float ysize={0.015}, xsize={0.01};
}
// PR12874
template<class T> struct addr_impl_ref {
T & v_;
inline addr_impl_ref( T & v ): v_( v ) {
}
inline operator T& () const {return v_;}
};
template<class T> struct addressof_impl {
static inline T * f( T & v, long ) {
return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
};
template<class T> T * addressof( T & v ) {
return addressof_impl<T>::f( addr_impl_ref<T>( v ), 0 );
}
void testRadar11487525_1(){
bool s[25];
addressof(s);
}
// Don't crash on CK_LValueBitCast.
bool begin(double *it) {
typedef bool type[25];
bool *a = reinterpret_cast<type &>(*( reinterpret_cast<char *>( it )));
return *a;
}
// Don't crash on "assuming" a ComoundVal.
class JSONWireProtocolInputStream {
public:
virtual ~JSONWireProtocolInputStream();
};
class JSONWireProtocolReader {
public:
JSONWireProtocolReader(JSONWireProtocolInputStream& istream)
: _istream{istream} {} // On evaluating a bind here,
// the dereference checker issues an assume on a CompoundVal.
~JSONWireProtocolReader();
private:
JSONWireProtocolInputStream& _istream;
};
class SocketWireProtocolStream : public JSONWireProtocolInputStream {
};
void test() {
SocketWireProtocolStream stream{};
JSONWireProtocolReader reader{stream};
}
// This crashed because the analyzer did not understand AttributedStmts.
void fallthrough() {
switch (1) {
case 1:
[[clang::fallthrough]]; // expected-error {{does not directly precede}}
}
}