[clang-tidy] Skip user headers named like C headers in `modernize-deprecated-headers` (#195507)
Previously `modernize-deprecated-headers` would match on any header with
the same name as standard library headers. This commit fixes the problem
by checking whether the include resolves to a system header.
Closes #45991
---------
Co-authored-by: Victor Chernyakin <chernyakin.victor.j at outlook.com>
[clang][bytecode] Create global variables for temporaries... (#195037)
... that are extended by other global variables.
If the temporary we create is extended by a variable that we index as a
global, create a global for the temporary, even if it's not an
`SD_Static` temporary.
[clang-format] Make ignored files unformatted instead of empty. (#170416)
Tools rely on the expectation that clang-format will output a formatted
file. In the case of ignored files, the formatted file should just be
the input file, untouched.
Fixes #170407
MCContext/TargetMachine: Take MCRegisterInfo and MCSubtargetInfo by reference. NFC (#195032)
Both MCRegisterInfo and MCSubtargetInfo are non-null at every callsite
that matters (only nullable in unit tests like
`llvm/unittests/CodeGen/MFCommon.inc`), mirroring the recent `const
MCAsmInfo &` cleanup.
* TargetMachine::getMCRegisterInfo and getMCSubtargetInfo return
references.
* MCContext's constructor takes const MCRegisterInfo & and
const MCSubtargetInfo &.
[libc][math] Refactor rint-nearbyint family to header-only (#195577)
Refactors the rint-nearbyint math family to be header-only.
part of: #147386
Target Functions:
- nearbyint
- nearbyintbf16
- nearbyintf
- nearbyintf128
- nearbyintf16
- nearbyintl
- rint
- rintbf16
- rintf
- rintf128
- rintf16
- rintl
[4 lines not shown]
[flang][NFC] Converted more tests from old lowering to new lowering (part 55) (#195291)
Converted tests:
- Lower/Intrinsics/ieee_unordered.f90
- Lower/Intrinsics/rrspacing.f90
- Lower/structure-constructors.f90
- Lower/transformational-intrinsics.f90
Removed test:
- Transforms/stack-arrays.f90: tested the stack-arrays pass on the
legacy --array-value-copy output of legacy lowering. The HLFIR pipeline
produces fundamentally different code for array slice copies
(_FortranAAssign with fir.embox of sub-slices instead of allocating a
temp via array-value-copy), so the test's premises no longer apply. The
HLFIR equivalent test already exists at
Transforms/stack-arrays-hlfir.f90.
[llubi] Add support for poison-generating/UB-implying annotations (#195339)
This patch adds support for poison-generating/UB-implying annotations,
including:
1. Parameter/retval attributes on function declarations and call sites
(range/nofpclass/align/nonnull/noundef/dereferenceable[_or_null]).
2. Metadata
(!range/!nofpclass/!align/!nonnull/!noundef/!dereferenceable[_or_null])
3. Assume operand bundles (nonnull/align/dereferenceable[_or_null])
I put all of them into a single patch as they share most of the common
logic.
Note that there are two todos to reach the full support:
1. Load with `!noundef` metadata doesn't check undef bits for now.
2. !dereferenceable[_or_null] on load (and inttoptr) are not tested by
this patch, as it needs the provenance support
(https://github.com/llvm/llvm-project/pull/185977). But it should be
fine as they are tested by metadata on call sites.
[DirectX] Update error messages after #194061 (#195553)
Since DirectX is an experimental target these tests aren't failing on
public bots, but they obviously do when building DirectX.
[DirectX] Add missing test update for #191528 (#195552)
In #191528 we added the string table to the YAML and updated many tests
that were affected, but it looks like this one was missed.
[ELF] Remove duplicate SHT_CREL writeTo branch and cover discarded section symbol path. NFC (#195558)
OutputSection::writeTo had two identical
`if (type == SHT_CREL && !(flags & SHF_ALLOC))` blocks added together in
0af07c078798 (#98115). Drop a dead copy.
A section relocation against a /DISCARD/'d section sees the section
symbol demoted to Undefined. Add a -r --crel case to relocatable-crel.s
that exercises that path.
[flang][cuda][openacc] Fix OpenACC use_device host association symbol copies (#194705)
When a use_device object comes from host association, the OpenACC
construct scope may already contain a HostAssocDetails symbol. Reusing
that symbol prevents semantics from applying the CUDA DEVICE attribute,
because the copied symbol is not an object entity. The fix materializes
the expected host-associated symbol in the containing scope, then
replaces the OpenACC-scope symbol with an ObjectEntityDetails copy that
can carry the device attribute.
This allows generic resolution and lowering to see the device version
inside the host_data construct while preserving the host-associated
binding needed by lowering.
[FileCheck][NFC] Complete FileCheckDiag class hierarchy
This patch depends on PR #???? and finishes its effort to decouple the
`-dump-input` presentation layer (in
`llvm/utils/FileCheck/FileCheck.cpp`) and the FileCheck library's
diagnostic emission (in `llvm/lib/FileCheck/FileCheck.cpp`).
The focus of this patch is finally eliminating `enum MatchType` and
completing the `FileCheckDiag` class hierarchy. That enables the
following improvements.
Replace MatchTy and InputRange
==============================
`-dump-input` needs some means to determine (1) whether some notes
should be filtered in by `-dump-input-filter=error`, and (2) where to
place some notes in the input dump. Without this patch series, the
FileCheck library provides that information by copying the following
from a match result to any note that does not have its own versions:
[47 lines not shown]
[FileCheck][NFC] Introduce MatchResultDiag and MatchNoteDiag
This patch depends on PR #???? and continues its effort to decouple
the `-dump-input` presentation layer (in
`llvm/utils/FileCheck/FileCheck.cpp`) and the FileCheck library's
diagnostic emission (in `llvm/lib/FileCheck/FileCheck.cpp`).
Similar to compiler errors/warnings/remarks vs. notes, the
`FileCheckDiag` series emitted by the FileCheck library contains match
results, each of which might be followed by a series of associated
notes before the next match result. Without this patch series, that
association is not formally modeled by `FileCheckDiag` or clearly
documented, and `-dump-input` is not able to easily reason about it.
This patch improves the situation by introducing two `FileCheckDiag`
derived classes: `MatchResultDiag` and `MatchNoteDiag`. It extends
`FileCheckDiagList` to directly associate each `MatchNoteDiag` with
its `MatchResultDiag`. Thus:
- `FileCheckDiagList::adjustPrevDiags` no longer has to determine that
[9 lines not shown]
[FileCheck][NFC] Introduce FileCheckDiagList for -dump-input
Problem
=======
`FileCheckDiag` and its `enum MatchType` have outgrown their original
purpose. The `-dump-input` presentation layer (in
`llvm/utils/FileCheck/FileCheck.cpp`) and the FileCheck library's
diagnostic emission (in `llvm/lib/FileCheck/FileCheck.cpp`) are too
tightly coupled. The interactions are subtle to understand and
maintain. It is difficult for the former to reason about the latter's
emitted diagnostics in order to present them in the most readable
manner.
Solution
========
This patch is the first in an NFC series that removes `MatchType` from
`FileCheckDiag` and refactors `FileCheckDiag` as the base class of a
[33 lines not shown]
[DWARFLinker] Treat NULL DIE references as resolution failures in parallel (#195363)
CompileUnit::resolveDIEReference returned whatever getDIEIndexForOffset
pointed at, even when the entry was a NULL tombstone. The classic linker
checks DWARFDie::isNULL(). Mirror that here so callers get std::nullopt
and warn.
Also fix the "cann't" typo at the two warning sites to match classic,
and enable `--linker parallel` in null-die.test.
[test] Cover R_RISCV_ADD/SUB and R_RISCV_RVC_{BRANCH,JUMP} (#195555)
These were uncovered according to an LLVM_BUILD_INSTRUMENTED_COVERAGE
build.
llvm-mc resolves `.L1 - .L0` differences at assembly time, so
riscv-reloc-add.s doesn't emit the R_RISCV_ADD*/R_RISCV_SUB* pairs it
was meant to test.
Add riscv-reloc-rvc.s, modeled on riscv-branch.s/riscv-jal.s, to
exercise R_RISCV_RVC_BRANCH and R_RISCV_RVC_JUMP. Drive offsets via
-Ttext + --defsym to land precise values that isolate complementary
extractBits groups.
[clang][NFC] Mark CWG2629 as implemented and add a test (#195490)
This is ill-formed:
```cpp
switch (0.0) {}
```
Before [CWG2629](https://wg21.link/cwg2629) though, this was allowed:
```cpp
switch (double d = 0.0) {} // Value of 'd' is implicitly converted to an integer
```
Clang however has always rejected both: https://godbolt.org/z/GYc4hhrnz