[clang] On Windows, silence warning in `CFGBackEdgesTest` with MSVC (#187939)
This fixes:
```
[5804/7029] Building CXX object tools\clang\unittests\CMakeFiles\AllClangUnitTests.dir\Analysis\CFGBackEdgesTest.cpp.obj
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\xutility(721): warning C4018: '>': signed/unsigned mismatch
...
C:\git\llvm-project\clang\unittests\Analysis\CFGBackEdgesTest.cpp(170): note: see the first reference to 'testing::internal::PredicateFormatterFromMatcher<testing::internal::SizeIsMatcher<testing::internal::GtMatcher<int>>>::operator ()' in 'clang::analysis::`anonymous-namespace'::CFGBackEdgesTest_WhileWithContinueLoop_Test::TestBody'
```
[RISCV] Add guard to prevent GPRPair merge on targets without Zdinx or P (#186600)
Resolves #186527.
The issue points out that GPRPair merge logic in the RISCVMoveMerger
pass was being called on a target without `zdinx` or `experimental-P`,
triggering an unreachable in `getGPRPairCopyOpcode`.
This patch fixes this issue by guarding `isEvenRegisterCopy` and
`isOddRegisterCopy` to return false when neither Zdinx nor P is present.
[SLP]Do not try to reduced instruction, marked for deletion in previous attempts
Need to skip instructions, which were vectorized and marked for deletion
to prevent a compiler crash
[MC,clang] Fix -Wa,--noexecstack not emitting .note.GNU-stack (#187880)
AsmPrinter (clang -c a.c) and AsmParser (clang -c a.s, llvm-mc
-filetype=obj a.s) have different ways to emit .note.GNU-stack section.
913c5b4d1fff removed a redundant initSections call from cc1as, but
that was the only place where NoExecStack was consumed for the
assembler path.
Unify the .note.GNU-stack emission in MCELFStreamer::finishImpl,
making the `initSections` parameter redundant.
Add a -filetype=obj test for Solaris (see
https://reviews.llvm.org/D159179), which doesn't use .note.GNU-stack
`initSections` has 20+ uses. The parameter cleanup will be deferred to a
subsequent change.
Fixes https://github.com/llvm/llvm-project/issues/186004
[clang-tidy] use-after-move: Support null_after_move annotations (#186903)
Extend the bugprone-use-after-move check to recognize user defined
smart-pointer-like types that make guarantees on the state of a
moved-from object, leaving it in a valid and specified state that
matches the standard smart pointer's moved-from state (nullptr), where
it is safe to use but not dereference.
Following the RFC discussion:
* Use `[[clang::annotate]]` to mark the types.
* Use an schema for the `[[clang::annotate]]` annotation and arguments
to help avoid conflicts with other users of the attribute.
* The annotation will identify the tool ("clang-tidy") and the arguments
the plugin ("bugprone-use-after-move"), and the behavior of the type
("null_after_move"). E.g.:
`[[clang::annotate("clang-tidy", "bugprone-use-after-move",
"null_after_move")]]`
[2 lines not shown]
[SystemZ] Remove custom lowering of f16 IS_FPCLASS (#187532)
As pointed out in #187518 , currently, `__builtin_isnormal` returns
`true` for subnormal half precision floating point numbers on `s390x.
This is because there is a custom lowering defined which lowers an `f16`
`IS_FPCLASS` ISD node by extending the `f16` value to `f32`, and then
using SystemZ's "test data class" instruction to determine whether the
number is subnormal. However, a number that is subnormal in 16 bits of
precision will no longer be subnormal in 32 bits of precision, and so
the test always returns true, i.e. all subnormal numbers are classified
as normal.
This PR addresses this by removing the custom lowering and instead
relying on the generic expansion of `IS_FPCLASS`, which does not have
this error.
Fixes #187518 .
[libc++] Fix includes in `<string>` for no-`wchar_t` modes (#187650)
Since befaa35212dbaac39cd76a8dc748e4df7c90a0d9, the CI stably failed for
the generic-no-wide-characters build, because in no-`wchar_t` modes, the
header for `__remove_cv_t` wasn't properly included.
This PR adds the missing include of `<__type_traits/remove_cv.h>`.
As drive-by, `<__cstddef/size_t.h>` and
`<__type_traits/is_constant_evaluated.h>`, which are included by
`<cwchar>`, are also made included by `<string>` to avoid potential
regression as we're using `size_t` and
`__libcpp_is_constant_evaluated()` in `<string>`.
[LLD] [ELF] Make {bti,gcs}-report=none silence warnings from force-bti/gcs=always (#186343)
Previously, the implicit warnings from force-bti (or gcs=always) weren't
possible to silence.
The force-ibt/cet-report flags could also be handled the same way, but I
haven't checked with GNU ld how they behave. And there, the force-ibt
flag only produces warnings if the IBT bit is missing, while cet-report
warns if either IBT or SHSTK are missing - but force-ibt probably
shouldn't implicitly start warning for missing SHSTK.
This addresses a discrepancy to GNU ld that was noted in #186173.
[mlir][linalg] Specialize transform op - emit category ops (#187506)
Adds optional attribute to allow specialization into category Linalg
ops.
The default behavior of the transform op remains unchanged.
[clang][CodeGen] Use FieldDecl::getFieldIndex() in VisitOffsetOfExpr (#187826)
Use FieldDecl::getFieldIndex() instead of manually iterating over
fields.
[orc-rt] Add Session::tryCreateService convenience function. (#187640)
Session::tryCreateService will try to create an instance of ServiceT by
forwarding the given arguments to the ServiceT::Create method, which
must return an Expected<std::unique_ptr<ServiceT>>.
This enables one-line construction and registration of Services with
fallible constructors (which are expected to be common).
[Clang] Use stable_sort in VerifyDiagnosticsConsumer. (#187827)
The new code introduced for `-verify-directives` in PR #179835 enforces
that the order of diagnostics matches the order of the directives.
However, before checking this, it sorts the directives by
SourceLocation. Perhaps non-obviously, all directives which appear
inside a single comment are given the same SourceLocation, pointing to
the beginning of the comment. While these are added in order they appear
in the comment, the non-stable std::sort may non-detministically
misorder them. Switching to stable_sort ensures the correct order is
verified.
This was observed as a random test failure on the checks in
clang/test/CXX/drs/cwg25xx.cpp lines 250 and 264, in some builds of
Clang. Note that those lines end in backslashes, and thus, despite
appearances, the directives on the following lines are also within the
same single comment.
[clang-format] Merge case alignment into AlignTokens (#187811)
Use (nearly) the same code to align case statements and expression, as
the other alignments do. That way we also fix two things:
- Keep the ColumnLimit intact, without duplicating the calculation.
- Align all the case colons, even for empty cases.