[CI][lldb] Add a github workflow that runs pylint on LLDB API test changes (#182003)
The motivator here is that Python allows class methods to be redefined.
But in the vast majority of cases this is a bug. E.g., in our API
test-suite two methods with the same name cause the latest definition to
shadow the earlier, in which case only one test-case runs. This happens
silently. Every couple of months i've been running the script from
https://github.com/llvm/llvm-project/pull/97043 manually on the
code-base and it catches a handful of these every time.
This patch sets up a github action that runs on pull requests that
change any files under `lldb/test/API`. The action runs `pylint` on the
changed Python files. The caveat here is that `pylint` isn't set up to
run cleanly on our test-suite. So I just use the [specific redefinition
error
code](https://pylint.readthedocs.io/en/stable/user_guide/messages/error/function-redefined.html).
Any other errors won't cause `pylint` to fail for now (hence the
`--error-under=0`).
[3 lines not shown]
[clang][ssaf] Add UnsafeBufferUsage summary data structures (#181067)
An UnsafeBufferUsage summary is the ssaf representation of the set of
unsafe buffer pointers found by `-Wunsafe-buffer-usage` in a translation
unit.
rdar://170176278
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[LifetimeSafety] Add UseFacts for function arguments and assignment RHS (#180446)
Add missing `UseFact` for binary operators and function call arguments
to track object usage.
These changes allow the analyzer to properly detect cases where an
object is used after being invalidated, particularly in container
operations like map access.
**Pointer vs Iterator Invalidation:**
Different containers provide different stability guarantees:
- **Pointer/Reference Stability**: Containers like `std::unordered_map`
guarantee that pointers and references to elements remain valid even
after insertions. This makes operations like `mp[2] = mp[1]` safe in
practice.
- **No Pointer Stability**: Containers like `std::flat_hash_map` (C++23)
do not provide pointer stability on insertion, making such operations
unsafe.
- **Iterator Stability**: Most containers (including
[4 lines not shown]
[APINotes] Document that Methods can now be nested under Tags
`Tags` can be nested under other `Tags`, which represents nested C++
classes.
`Methods` can be nested under `Tags`, which represents C++ methods.
rdar://151033780
[AMDGPU][SIInsertWaitcnts][NFC] Clean up loop (#179572)
After merging https://github.com/llvm/llvm-project/pull/181760 this loop
no longer erases instructions while iterating. So this patch moves the
iteration increment inside the for statement.
Note: Replacing the loop with a range loop like `for (MachineInstr
&Instr : Block)` is not an NFC.
[MLIR] Graceful handling of uninitialized sparse tensor encodings with `sparse-tensor-codegen` (#181145)
This PR handles the case where users call the `--sparse-tensor-codegen`
pass without sufficiently lowering dense tensors to sparse ones (with
passes like `--lower-sparse-ops-to-foreach` and
`--lower-sparse-foreach-to-scf` among others). This results in dense
tensors having a null `SparseTensorEncodingAttr`, which was originally
assumed to be true in the SparseTensor's `ConvertOp` lowering, but is
now checked against.
This PR closes #177779.
[NCFI][OpenMPIRBuilderTest] remove some trivial uses of getAllocatedType (#181722)
These are the required uses of the alloca type, but have trivial access
to the expected result of that API call. The remaining uses in unittests
are for testing the LLVM API itself.
Co-authored-by: Claude Sonnet 4.5 <noreply at anthropic.com>
[APINotes] Document that Methods can now be nested under Tags
`Tags` can be nested under other `Tags`, which represents nested C++ classes.
`Methods` can be nested under `Tags`, which represents C++ methods.
rdar://151033780
Re-enable MSVC C4592 diagnostic; NFC (#182503)
This diagnostic is no longer documented on MSDN, but the diagnostic text
was:
> ''var': symbol will be dynamically initialized (implementation
limitation)
This was disabled in 5cbf37fe3703ee7744f864a53df443ab97e29af7 to work
around false positives with MSVC 2015 Update 1. I believe those false
positives have been fixed and this diagnostic no longer needs to be
disabled. Local testing shows it is not emitted.
[clang-tools] Fix cl::opt usage with Clang+PCH+dylib
Clang instantiates the vtable but not the method compare() of
OptionValueCopy<std::string> when using PCH. compare() is instantiated
as past of libLLVM.so, but due to -fvisibility-inlines-hidden, the
function is not visible when linking the tool. This might be a Clang
bug.
In any case, avoid this problem by disabling PCH.
Fix crash in clang_getUnaryOperatorKindSpelling() (#182247)
When clang_getUnaryOperatorKindSpelling() is called with
CXUnaryOperator_Invalid as argument, UnaryOperator::getOpcodeStr() gets
called with an invalid Opcode of -1, leading to a crash.
Fix it by checking for the last valid opcode as is done in
clang_getBinaryOperatorKindSpelling().
Do the same for clang_getBinaryOperatorKindSpelling(), as its logic is
the same.
[lldb][windows] keep track of interrupted reads in ConnectionGenericFile (#182536)
If a read is interrupted in `ConnectionGenericFile::Read`, the data that
has already been read by `ReadFile` is lost.
This patch adds `m_read_pending` to mark a read as interrupted. The next
read will pick up the results of the previous read and return the number
of `bytes_read`.
[clang][ARM] Refactor argument handling in `EmitAArch64BuiltinExpr` (2/2) (NFC)
Refactor `EmitAArch64BuiltinExpr` so that all AArch64/NEON builtins
handled by this hook _and marked as overloaded_ share a common path
for generating LLVM IR arguments (collected into the `Ops`
`SmallVector<Value*>`) (*). This is a follow-up for #181794 - please
refer to that PR for more context.
As in the previous PR, the key change is implemented in
`HasExtraNeonArgument` , i.e. in the hook that identifies Builtins with
the extra argument. In this PR, I am replacing the ad-hoc switch
statement with a more principled approach borrowed from SemaARM.cpp,
namely:
```cpp
uint64_t mask = 0;
switch (BuiltinID) {
#define GET_NEON_OVERLOAD_CHECK
#include "clang/Basic/arm_fp16.inc"
#include "clang/Basic/arm_neon.inc"
[28 lines not shown]
[Hexagon] Add HexagonGlobalScheduler pass (#180803) (#181961)
This patch adds the HexagonGlobalScheduler, a post-packetization pass
that performs global instruction scheduling and pull-up optimizations to
improve packet density on Hexagon VLIW architecture.
The scheduler operates on scheduling regions (super-blocks with single
entry and multiple exits) and attempts to move instructions across basic
blocks to fill packet slots more efficiently. It supports both
speculative and predicative scheduling modes.
Key features:
- Global instruction scheduling across basic blocks
- Speculative scheduling with safety checks
- Predicative scheduling using predication
- Local pull-up within basic blocks
- Dual jump formation
- Branch optimizations
- Liveness preservation using HexagonLiveVariables
[28 lines not shown]