[analyzer] Fix -analyzer-output=html assert on reversed and macro ranges
HTMLDiagnostics::HighlightRange guarded against a reversed range by
comparing line numbers, so a same-line reversal - which is what the piece for
an implicit copy constructor carries - reached html::HighlightRange.
Its scan walks from begin to end, ran off the end of the buffer, and asserted:
https://godbolt.org/z/sTb5qfjjd
Invalid position to insert! (RewriteRope.h)
It also added the end token's length itself and then passed a token range to
html::HighlightRange, which measured the token again, this time from the
interior. For most tokens the two cancel, but where the tail re-lexes longer
the highlight reached past the end of the range, e.g. over a trailing ';'.
Use getExpansionRangeInFile(), which rejects reversed and cross-file ranges,
then convert once and tell html::HighlightRange the range is already
char-granular.
[4 lines not shown]
[analyzer] Fix -analyzer-output=sarif crash on macro-expanded ranges
A path piece whose range ends inside a macro expansion aborted the whole
document: https://godbolt.org/z/61vWYcsWj
Cannot create a physicalLocation from invalid SourceRange!
convertTokenRangeToCharRange() built the end with
Lexer::getLocForEndOfToken(), which returns an invalid location for a macro
ID that is not at the end of its expansion, and used it unchecked. The
analyzer's own test corpus hits this in nine files; text and plist output
were unaffected because both already map such ranges to the expansion.
- Use getExpansionRangeInFile(), so the region covers the macro use like the
other two outputs.
- Fall back to a caret when the range is unusable. A thread flow needs a
location per piece, so dropping one would truncate the reported path. This
also stops reversed ranges producing regions with endColumn < startColumn.
[4 lines not shown]
[clang] Reject ranges getExpansionRangeInFile cannot represent
getExpansionRangeInFile was extracted verbatim and inherited two shortcomings
of the original loop, fixed here before the analyzer's SARIF and HTML consumers
depend on it:
- It mapped the end with getExpansionRange(SourceLocation), which always
reports a token range, so a char-range input was widened by a whole token.
Now using the getExpansionRange(CharSourceRange) overload, which keeps the flag.
- It passed reversed ranges through. Consumers walk begin->end; now returning
nullopt for those, as Lexer::makeFileCharRange already does.
Separate from the extraction so that stays NFC, and out of the consumer fixes
because it changes the shared helper's contract rather than one output.
Both contract changes, plus the invalid- and cross-file-range guards, are
covered by a GetExpansionRangeInFile unit test in
clang/unittests/Frontend/TextDiagnosticTest.cpp.
Assisted-By: claude
[clang][NFC] Extract getExpansionRangeInFile out of the diagnostic renderers (#214460)
Prep for the following commits, which fix crashes in the analyzer's
SARIF and HTML output on ranges that end inside a macro expansion.
Fixing them means mapping such a range into the reported file - the
normalization the frontend text and SARIF renderers already do, and that
the two analyzer consumers each do differently and incorrectly.
Hoist that logic into getExpansionRangeInFile, beside the DiagnosticRenderer
base both frontend renderers derive from, so the fixes reuse one
implementation instead of adding two more copies. TextDiagnostic and
SARIFDiagnostic move onto it here with no behavior change; the analyzer
consumers follow in later commits.
getFileID() replaces SARIFDiagnostic's getDecomposedLoc(...).first - equivalent
here, and what TextDiagnostic has used since c113cbb51005.
Assisted-By: claude
[InstCombine] Fold uadd.sat(X, C) - C to umin(X, ~C) (#215130)
`uadd.sat(X, C) - C --> umin(X, ~C)` for nonzero `C`.
The saturating add gives `X + C` or `UMAX`, so subtracting `C` leaves
`X` or
`UMAX - C`, which is the unsigned minimum. `UMAX - C == ~C`, so the
constant
is just the inverted `C`.
There was already a test documenting this miss in saturating-add-sub.ll
(`test_scalar_uadd_sub_const`) - it folds now.
https://alive2.llvm.org/ce/z/kLFWy7
Fixes #215103
[libc++] Simplify detection of win32-broken-utf8-wchar-ctype (#214797)
Instead of querying `_LIBCPP_HAS_LOCALIZATION` from Python, do it from
the source program. This fixes a bug where if `_LIBCPP_HAS_LOCALIZATION`
was not defined at all (which is the case for older versions of libc++),
the feature would then be defined immediately, regardless of the
platform we're on. That's because `and` has higher precedence than `or`
in Python, so we'd end up skipping the `_WIN32` check entirely.
[lldb][test] Remove Python <= 3.6 workaround (#215262)
re.Pattern was added in 3.7 and our minimum
is now 3.8.
Python 3.6.15:
>>> import re
>>> re.Pattern
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 're' has no attribute 'Pattern'
Python 3.7.17:
>>> import re
>>> re.Pattern
<class 're.Pattern'>
Python 3.8.20:
>>> import re
[3 lines not shown]
Firewall: NAT: Destination NAT - add proper support for container items in search field selection, export and import data, implement this in DNAT ui. closes https://github.com/opnsense/core/issues/10691
Fix AArch64 ISel for unpacked types
Using DUP instructions only really works for packed types, as it will
not introduce the spacing between elements that is required for unpacked
types like nxv2f16.
For those, we'll first broadcast to their corresponding packed type, and
then extract the lo lanes into an unpacked type, effectively introducing
the required spacing.
DAG: Use poison instead of undef in SimplifyDemandedVectorElts
I left getKnownUndefForVectorBinop since I'm not sure
if it's correct to just replace with poison.
DAG: Skip poison elements in BUILD_VECTOR computeKnownBits (#213326)
This defends against regressions in future patches. Copies the logic
from the IR version of computeKnownBits's handling of ConstantVector.
I'm not sure why the IR version doesn't directly return a value for
poison, but this follows suit.
Co-authored-by: Claude (Claude-Opus-4.8)
[clang][bytecode] Remove the !Caller case in Ret opcodes (#215226)
The bottom frame is always created via an `EvalEmitter`, which has its
own implementation of the `Ret` opcode. The exception is
`Context::Run`/`isPotentialConstantExpr`.
[GlobalISel] Fix vector.deinterleave2 with <1 x float> results (#214718)
`translateVectorDeinterleave2Intrinsic` used to try to build
`G_SHUFFLE_VECTOR`
with a scalar result type, which is not valid.
This was the case because the LLT that corresponds to the `<1 x float>`
IR type is a scalar type, not a vector type.
Add a special case for scalar result types to build
`G_EXTRACT_VECTOR_ELT` instead.
Fixes: #214713
www/caddy: Move model mount to OPNsense namespace (#5616)
* www/caddy: Move model mount to OPNsense namespace
* www/caddy: Bump plugin version to 2.2.0
ports-mgmt/pkg-devel: update to 2.8.99.1
Changes:
- security: bound vulnerability database downloads and decompression; build a temporary database and atomically replace it only after validation
- security: bound repository archive downloads and extraction (1 GiB or half of free temporary storage, 1 MiB metadata) and reject duplicate members and oversized target members
- security: bound repository signature extraction (8 MiB callback response, at most 8 signature entries of 1 MiB each)
- security: drop to nobody before entering Capsicum in the sandboxed archive and signature callbacks
- security: enforce the signed package size while fetching, capping the stream even when the server omits a Content-Length
- security: reject invalid repository signature types; only pubkey, fingerprints and none are accepted
- repo: keep file lists out of the data catalog
- repo: open the catalogue read-only when checking its validity
- rwhich: store the compressed filesite as a standalone file
- rwhich: verify the repository signature and store the filesite as a raw compressed file
- rwhich: add a global and a per-repository configuration
- fix: report (added)/(removed) reinstall reasons only once
- fix: use-after-free during the additional SAT cycle
- fix: deferred rc script execution
- rcscript: add a dedicated PKG_EVENT_RC_SCRIPT event for rc.d script actions
- fix: remove leftover nested @dir parents on deinstall
[6 lines not shown]