[clang-tidy] Add `readability-redundant-zero-initializer` (#209367)
Add a check that finds explicit single-element zero initializers of
arrays and rewrites them to empty braces, e.g. `char a[12] = {0};`
becomes `char a[12] = {};`. Empty-brace initialization zero-initializes
every element, so the explicit `{0}` is redundant. The check is only
enabled in C++ and in C23 or later.
The check is conservative and only rewrites a single-element `{0}` list
whose sole element is the integer literal `0` and whose array has an
explicit bound. It leaves alone, among others:
- arrays whose bound is deduced from the initializer (`char a[] = {0};`)
- multi-dimensional arrays (`int m[2][3] = {0};`)
- initializers with more than one element (`int a[3] = {0, 0};`);
- scalars and class/struct types
- zero written in another form such as `'\0'`, `0.0` or `nullptr`
Closes #209139
[2 lines not shown]
[X86] extractsubvector-load.ll - basic test coverage for various extractsubvector(load) patterns (#216156)
Shows some poor codegen for non-aligned subvector indices
Basic frozen load test coverage for #216115
[CIR] Address reviewer feedback
The comments on isEmptyFieldForABI and isEmptyRecordForABI were too verbose. Adapt the comments on classic's isEmptyField and isEmptyRecord.
Add flexible array member tests.
Assisted-by: Cursor / claude-opus-5
[NFC][analyzer] Clarify that ArrayBound only handles element regions (#216049)
The `security.ArrayBound` checker does not do anything when the value of
the expression that activated its callbacks isn't expressed as an
`ElementRegion`.
Previously this was a sneaky consequence of the logic in
`computeOffset`, but this commit highlights it with a straightforward
early return statement to ensure that the accessed element region is
available within the body of `ArrayBoundChecker::handleAccessExpr`.
(I intend to use this in a follow-up commit.)
Document that the swiftcall and swiftasynccall attributes are ABI-unstable (#215915)
...except on platforms where the Swift projects has declared ABI
stability.
[flang][OpenMP] Support for "atomic compare capture" (#202315)
Adding support for "!$omp atomic compare capture".
This also Fixes [#202311](https://github.com/llvm/llvm-project/issues/202311)
Co-authored-by: Sunil Kuravinakop <koops at hpe.com>
[clang][docs] Fix Markdown code fence languages
Use more precise lexer names for code fences in the Clang Markdown migration:
HLSL examples use hlsl, Itanium ABI grammar uses bnf, CIR snippets that are
valid MLIR use mlir, and HWASAN assembly-style listings use objdump.
Keep plain text fences for bytecode dumps, AST dumps, diagrams, pseudocode, and
CIR snippets that contain placeholders rejected by the MLIR lexer.
[AMDGPU][GlobalISel] Fix wide multiply with known-zero parts (#215356)
Materialize a zero accumulator when all partial products for a
destination part are skipped, avoiding an invalid null register during
legalization.
[OpenMP][OMPT] Mark dispatch callback as sometimes on registration (#212991)
Recently, multiple issues in the implementation of the `dispatch`
callback have been found (e.g., #212784, #207746). In these, the code
generation done by Clang and Flang does not provide a sufficient amount
of information for the runtime to dispatch the correct amount of flags,
or a callback for a given event at all.
These missing and incorrect events do not satisfy OpenMP's requirement
for `ompt_set_always` as a registration result, as the runtime does not
trace or invoke the correct callback whenever an associated event occurs
(OpenMP v5.2, p. 457, l.5-6).
As such, change the registration result for the `dispatch` callback to
`ompt_set_sometimes` for now, which is fulfilled. Here, an
implementation can dispatch callbacks or trace an implementation-defined
subset of associated event occurrences.
Based on the changed registration result, a tool can then decide if they
are still interested in recording the information provided by the
[2 lines not shown]
[LAA] Add more tests with symblic strides with different scales (NFC) (#216128)
Add more test coverage for various cases with strides with different
scales.
[OpenMP][OMPT] Make omp_control_tool enums available in omp-tools.h (#216076)
OpenMP 6.1 will introduce this change: the enums must be available by
including either header file, but including both must also be valid.
[clang] Move DefaultedFunctionKind from Sema to AST (#214846)
I plan on using this to implement DW_AT_defaulted in CGDebugInfo.
Putting this on FunctionDecl itself seems like a better move than
reaching into Sema from CGDebugInfo.
See: https://github.com/llvm/llvm-project/pull/213188
[libc++] Cache anchor commits in the benchmark cron (#216124)
Selecting the anchor commits is the only step that needs a full monorepo
clone, so we instead cache it and recompute it once per day.
Fixes #215447
[LLDB] Fix tool dependency tracking on windows (#215927)
On Windows $(CXX) is converted into "$(CXX)" which doesn't work as a
path as needed by dependency tracking. Separate the two uses.