486958 Commits

Author SHA1 Message Date
FantasqueX
f9e2e85b07
[Clang] Use const pointer to eliminate warning with libxml 2.12.0 (#76719)
Currently, if `CLANG_HAVE_LIBXML` is defined, and the version of libxml2
is above 2.12.0, there will be two warnings when building clang.

warning: initializing 'xmlErrorPtr' (aka 'struct _xmlError *') with an
expression of type 'const xmlError *' (aka 'const struct _xmlError *')
discards qualifiers

Since this commit

45470611b0,
libxml2 makes cmlGetLastError return a const error. This patch follows
libxml2. Making the result a const pointer should be compatible with
versions before 2.12.0.

Tested on ArchLinux with libxml2 2.12.3 installed.
2024-01-21 10:34:29 +01:00
Matthias Springer
62bf7710ff
[mlir][IR] Add notifyBlockRemoved callback to listener (#78306)
There is already a "block inserted" notification (in
`OpBuilder::Listener`), so there should also be a "block removed"
notification.

The purpose of this change is to make the listener API more mature.
There is currently a gap between what kind of IR changes can be made and
what IR changes can be listened to. At the moment, the only way to
inform listeners about "block removal" is to send a manual
`notifyOperationModified` for the parent op (e.g., by wrapping the
`eraseBlock(b)` method call in `updateRootInPlace(b->getParentOp())`).
This tells the listener that *something* has changed, but it is somewhat
of an API abuse.
2024-01-21 10:06:53 +01:00
Fangrui Song
d0230446d2 [AArch64] Remove non-sensible define nonlazybind test
nonlazybind is for declarations, not for definitions. We could test the
behavior, but the output would be misleading.
2024-01-20 23:39:07 -08:00
Konstantin Varlamov
dc57752031
[libc++][hardening] Categorize assertions that produce incorrect results (#77183)
Introduce a new `argument-within-domain` category that covers cases
where the given arguments make it impossible to produce a correct result
(or create a valid object in case of constructors). While the incorrect
result doesn't create an immediate problem within the library (like e.g.
a null pointer dereference would), it always indicates a logic error in
user code and is highly likely to lead to a bug in the program once the
value is used.
2024-01-20 23:38:02 -08:00
Vitaly Buka
f0c920ffb7
[libc++][hardening] XFAIL tests with HWASAN (#78866)
Follow up to #78862

These tests control hardening mode with `ADDITIONAL_COMPILE_FLAGS`, and
always set modes which use on TRAP. So we don't need to check
`libcpp-hardening-mode=fast`, and they must always fail with the current
HWASAN implementation.
2024-01-20 23:26:48 -08:00
Aiden Grossman
61d098962e Revert "Add workflow to release mlgo utils"
This reverts commit aa04d2b78bbbfef213d860876948b934ab18b1aa.

Meant to push this to my fork and did not realize I was on main and not
a separate branch.
2024-01-21 06:43:01 +00:00
Aiden Grossman
aa04d2b78b Add workflow to release mlgo utils 2024-01-21 06:40:05 +00:00
Fangrui Song
f9614b328a [AArch64] Improve nonlazybind test
Prepare for -fno-plt implementation.
2024-01-20 22:16:29 -08:00
Hristo Hristov
3412bc7658
[libc++][variant] P2637R3: Member visit (std::variant) (#76447)
Implements parts of: `P2637R3` https://wg21.link/P2637R3
(https://eel.is/c++draft/variant.visit)

Implements:
`variant.visit()`
`variant.visit<R>()`

The tests are as close as possible to the non-member function.

To land after: https://github.com/llvm/llvm-project/pull/76268

---------

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-21 07:16:51 +02:00
ZhangYin
6bb5c989bd
[libc++] <experimental/simd> Add load constructor for class simd/simd_mask (#76610) 2024-01-21 12:48:30 +08:00
Aiden Grossman
a70d3101ba [MLGO] Disable mlgo-utils tests on Windows builders
This patch disables the mlgo-utils tests on Windows builders. MLGO is
not currently supported on Windows.

These tests were failing as some of them look for specific file paths
and the path conventions are different between Linux and Windows.
2024-01-21 03:54:25 +00:00
Aiden Grossman
8e99a63899 [Github] Update paths for mlgo PR subscribers
This patch updates the paths in the PR labelling config for the MLGO
label. In particular, the path for the new mlgo-utils subfolder under
llvm/utils has been added and two other files that were missed in the
original introduction.
2024-01-21 03:37:18 +00:00
Aiden Grossman
39f1ca522b [MLGO] Remove absl dep from libraries
The library files in the new mlgo-utils utilities folder only depend on
absl.logging. The builtin Python logging library is a direct drop-in
replacement here, so we can just change the include and drop the test
dependency.
2024-01-21 03:33:15 +00:00
Kazu Hirata
bb6564a1b5 [TableGen] Use StringRef::consume_front (NFC) 2024-01-20 18:57:36 -08:00
Kazu Hirata
f523a5522b [Sema] Use llvm::all_of (NFC) 2024-01-20 18:57:35 -08:00
Kazu Hirata
1ce5a80d08 [Mips] Use MachineBasicBlock::pred_size (NFC) 2024-01-20 18:57:33 -08:00
Kazu Hirata
24790a7788 [Hexagon] Use llvm::children (NFC) 2024-01-20 18:57:31 -08:00
Kazu Hirata
9b2c25c704 [clang] Use SmallString::operator std::string (NFC) 2024-01-20 18:57:30 -08:00
Vassil Vassilev
2759e47067
[clang-repl] We do not need to call new in the object allocation. (#78843)
This test demonstrates template instantiation via the interpreter code.
In order to do that we can allocate the object on the stack and extend
its lifetime by boxing it into a clang::Value.

That avoids the subtle problem where we call the new operator on an
object only known to the interpreter and we cannot destroy it from
compiled code since there is not suitable facility in clang::Value yet.

That should resolve the asan issues that was reported in
llvm/llvm-project#76218.
2024-01-20 17:00:38 -08:00
Jerry Wu
dedc7d4d36
[mlir] Exclude masked ops in VectorDropLeadUnitDim (#76468)
Don't insert cast ops for ops in `vector.mask` region in
`VectorDropLeadUnitDim`.
2024-01-20 19:37:46 -05:00
lntue
975deb3664
[libc] Add missing header ioctl.h on aarch64. (#78865) 2024-01-20 18:16:45 -05:00
XDeme
a464e05109
[clang-format] Handle templated elaborated type specifier in function… (#77013)
… return type.

The behavior now is consistent with the non template version.
Enabled and updated old test.
2024-01-20 14:47:58 -08:00
Kazu Hirata
11b3b10856 [Support] Use llvm::children and llvm::inverse_children (NFC) 2024-01-20 14:30:37 -08:00
Kazu Hirata
851143608e [Frontend] Use SmallString::operator std::string (NFC) 2024-01-20 14:30:36 -08:00
Kazu Hirata
aa530c7d00 [Passes] Use a range-based for loop with llvm::successors (NFC) 2024-01-20 14:30:34 -08:00
Kazu Hirata
81218356fd [Sparc] Use StringRef::starts_with_insensitive (NFC) 2024-01-20 14:30:32 -08:00
Kazu Hirata
84cb8eaeeb [Sema] Use llvm::is_contained (NFC) 2024-01-20 14:30:30 -08:00
Vincent Lee
06ca52e252
[InlineOrder] Fix InlineOrder erase_if implementation (#78684)
The InlineOrder Heap stores a CallBase ptr and InlineHistoryID pair.
When running the `erase_if` method, InlineHistoryID is always returned
with 0. Instead, we should be retrieving it from the `InlineHistoryMap`
(similar to what is done in the `pop` implementation).

This change is completely harmless because no one is using
InlineHistoryID right now as part of the `erase_if` implementation which
is currently only used in the ModuleInliner.
2024-01-20 14:22:31 -08:00
David Green
49212d1601
[Flang] Fix for replacing loop uses in LoopVersioning pass (#77899)
The added test case has a loop that is versioned, which has a use of the
loop in an if block after the loop. The current code replaces all uses
of the loop with the new version If, but only if the parent blocks
match. As far as I can see it should be safe to replace all the uses,
then construct the result for the If with op.op.
2024-01-20 22:16:05 +00:00
OldWorldOrdr
46a9135d61
[lld-macho] Find objects in library search path (#78628)
Find object files in library search path just like Apple's linker, this
makes building with some older MacOS SDKs easier since clang runs with
`-lcrt1.10.6.o`
2024-01-20 13:53:55 -08:00
Hristo Hristov
07b5829fca
[libc++] FreeBSD CI: Adds <signal.h> to check_assertion.h (#78863)
...in attempt to fix the FreeBSD CI.

I noticed that suddenly some tests in the latest PRs fail to compile on
FreeBSD (`SIGILL` and `SIGTRAP` not defined). This tries to resolve
the issue.

Co-authored-by: Zingam <zingam@outlook.com>
2024-01-20 13:48:48 -08:00
Vitaly Buka
aaa7de1fc9
[libc++][hardening] XFAIL test in fast mode under HWASAN (#78862)
After #77883, `fast` mode uses TRAP, and HWASAN
replaces TRAP with abort or error exit code.

On a quick looks it should be possible to avoid doing
that in HWASAN, but historically this is convention for all
sanitizers. Changing this behavior may break existing
users.

Other sanitizers are not affected because they don't
install TRAP handlers by default. But if they do, they also
replace TRAP with abort/exit.
2024-01-20 13:37:38 -08:00
XDeme
2fc2ee136c
[clang-format] Fix poor spacing in AlignArrayOfStructures: Left (#77868)
Fixes llvm/llvm-project#62904

`AlignArrayOfStructures: Left` combined with `SpacesInParentheses: true`
causes the first cell of every row to have 1 additional space.
We were only setting the first cell of the first row to be against the
left brace, now every row will be against the left brace.
2024-01-20 13:34:37 -08:00
Hui
85a8e5c3e0
[libc++] fix condition_variable_any hangs on stop_request (#77127)
When I implemented `condition_variable_any::wait`, I missed the most
important paragraph in the spec:

> The following wait functions will be notified when there is a stop
request on the passed stop_token.
> In that case the functions return immediately, returning false if the
predicate evaluates to false.

From
https://eel.is/c++draft/thread.condition#thread.condvarany.intwait-1.

Fixes #76807
2024-01-20 21:18:44 +00:00
lntue
1cc7cd46a9
[libc] Fix size_t used without including stddef.h in CPP/limit.h. (#78861) 2024-01-20 16:14:17 -05:00
Daniil Dudkin
0175a1e4d3
new-prs-labeler: Add clang-tools-extra labeling (#78633)
There is no automatic labeling for the Extra Clang Tools, except
Clang-Tidy and ClangD.
2024-01-20 23:19:17 +03:00
LEE KYOUNGHEON
448b8e6162
Module documentation improvement: prebuilt module location can be directly fetched via CMake variable. (#78405)
CMake officially supports binary directory variable of installed
dependency using `FetchContent`. According to the current documentation,
it fetches `std` module and use its binary directory as hardcoded
string, `${CMAKE_BINARY_DIR}/_deps/std-build`, however it can be
replaced with `${std_BINARY_DIR}`.

Reference: https://cmake.org/cmake/help/latest/module/FetchContent.html
2024-01-20 21:06:02 +01:00
lntue
ce8fcad5f4
[libc] Fix float.h header to include the system float.h first and add more definitions. (#78857) 2024-01-20 14:44:51 -05:00
Nathan Sidwell
0880742a60
[NFC] Rename internal fns (#77994)
Internal functions should use a lowerCaseName, thus renamed.
2024-01-20 14:23:37 -05:00
Joseph Huber
ec0ac85e58 [Clang][Obvious] Correctly disable Windows on linker-wrapper test 2024-01-20 12:53:03 -06:00
kelbon
818de32f31
Warning for incorrect use of 'pure' attribute (#78200)
This adds a warning when applying the `pure` attribute along with the `const` attribute, or when applying the `pure` attribute to a function with a `void` return type (including constructors and destructors).

Fixes https://github.com/llvm/llvm-project/issues/77482
2024-01-20 12:37:35 -05:00
nsurbay
b9a1e2ab8d
[AArch64] Rename LDAPR<x>pre to LDAPR<x>post (#77340)
The feature FEAT_LRCPC3 introduces post-increment version of LDAPR and
LDIAPP instructions. The current disassembly of theses instructions is
correct but the opcode name is misleading with a 'pre' suffix instead of
'post'.

see :
-
https://developer.arm.com/documentation/ddi0602/2023-12/Base-Instructions/LDAPR--Load-Acquire-RCpc-Register-
-
https://developer.arm.com/documentation/ddi0602/2023-12/Base-Instructions/LDIAPP--Load-Acquire-RCpc-ordered-Pair-of-registers-
2024-01-20 17:07:14 +00:00
Congcong Cai
0f80f5e362 [NFC] fix typo in clang/include/clang/Sema/ScopeInfo.h 2024-01-20 22:43:15 +08:00
Ryan Landay
d01145f760
Fix typo in AttrDocs.td (__single_inhertiance => __single_inheritance) (#78838) 2024-01-20 09:20:22 -05:00
Martin Storsjö
d0986519d5
[LLD] [COFF] Preserve directives and export names from LTO objects (#78802)
The export names are saved as StringRefs pointing into the COFF
directives. In the case of LTO objects, this can be memory allocated
that is owned by the LTO InputFile, which gets destructed when doing the
compilation.

In the case of LTO objects from an older version of LLVM, which require
being upgraded when loaded, the directives string gets destructed, while
when using LTO objects of a matching version (the common case), the
directives string points into memory that doesn't get destructed on LTO
compilation.

Test this by linking a bundled binary LTO object file, from an older
version of LLVM.

This fixes issue #78591, and downstream issue
https://github.com/mstorsjo/llvm-mingw/issues/392.
2024-01-20 16:15:44 +02:00
Hirofumi Nakamura
fcb6737f82
[clang-format] Support of TableGen identifiers beginning with a number. (#78571)
TableGen allows the identifiers beginning with a number.
This patch add the support of the recognition of such identifiers.
2024-01-20 21:15:58 +09:00
Kerry McLaughlin
a8a3711e74
[AArch64][SME2] Preserve ZT0 state around function calls (#78321)
If a function has ZT0 state and calls a function which does not
preserve ZT0, the caller must save and restore ZT0 around the call.
If the caller shares ZT0 state and the callee is not shared ZA, we must
additionally call SMSTOP/SMSTART ZA around the call.

This patch adds new AArch64ISDNodes for spilling & filling ZT0.
Where requiresPreservingZT0 is true, ZT0 state will be preserved
across a call.
2024-01-20 12:06:00 +00:00
Congcong Cai
fd3346dba8
[clang-tidy] fix modernize-use-auto incorrect fix hints for pointer (#77943) 2024-01-20 20:05:22 +08:00
Jay Foad
63d7ca924f
[AMDGPU] Add GFX12 llvm.amdgcn.s.wait.*cnt intrinsics (#78723) 2024-01-20 11:44:42 +00:00
LLVM GN Syncbot
920bb5430a [gn build] Port 7a8f5d97afbf 2024-01-20 09:52:13 +00:00