[clang] fix typo correction crash with template destructor names (#207101)
Disables typo correction for template destructor names, as typo
correction is not aware of destructors and would provide suugestions
which would form an invalid name.
Since this fixes a regression that was never released, there are no
release notes.
Fixes #206992
[clang] Fix crash in VisitVarTemplatePartialSpecializationDecl on failed instantiation (#200161)
Fixes #198890
When a class template is explicitly instantiated and a member variable
template's type involves a substitution failure (e.g. `typename T::type`
with `T=int`), `VisitVarDecl` returned `nullptr`, causing
`VisitVarTemplateDecl` to bail out before registering the
`VarTemplateDecl` in the owner's lookup table. A subsequent call to
`VisitVarTemplatePartialSpecializationDecl` then hit an assert
(`!Found.empty()`) on the empty lookup result.
Fix: When `SubstType` fails and `InstantiatingVarTemplate=true`, recover
by using `int` as the type (via `getTrivialTypeSourceInfo(IntTy)`) and
mark the resulting `VarDecl` invalid. This ensures
`VisitVarTemplateDecl` always receives a valid `VarDecl` and finishes
registering the `VarTemplateDecl`, preserving the invariant the asserts
rely on.
A regression test is added in `clang/test/SemaTemplate/GH198890.cpp`.
[orc-rt] Fix unused Expected::isFailureOfType, add testcase. (#207105)
Expected::isFailureOfType method template was calling a non-existant
Error::isFailureOfType method, but didn't trigger any compile errors as
isFailureOfType was unused. This commit fixes isFailureOfType and adds a
testcase to exercise it.
wg-userspace(8): Ignore recvfrom errors.
On IPv6 networks, issuing sendto(2) when we've lost IPv6 connectivity
may eventually lead to the next recvfrom(2) failing with EHOSTDOWN.
Example ktrace:
8072 16529 rump_server 1782951176.090085182 CALL sendto(0xa,0x70fb4fa1b50c,0x60,0,0x70fb4f236b00,0x1c)
8072 16529 rump_server 1782951176.090085664 MISC msghdr: [name=0x70fb4f236b00, namelen=28, iov=0xffffc5126bfa8f50, iovlen=1, control=0x0, controllen=0, flags=0]
8072 16529 rump_server 1782951176.090086919 MISC mbsoname: [2601:...]
8072 16529 rump_server 1782951176.090093493 GIO fd 10 wrote 96 bytes
8072 16529 rump_server 1782951176.090094033 RET sendto 96/0x60
...
8072 23248 rump_server 1782951180.090105990 CALL recvfrom(0xa,0x70fb4efe203c,0x233a,0,0x70fb3f7cff50,0x70fb3f7cff4c)
8072 23248 rump_server 1782951180.090106339 MISC msghdr: [name=0x0, namelen=0, iov=0xffffc5126c63ff20, iovlen=1, control=0x0, controllen=0, flags=0]
8072 23248 rump_server 1782951180.090107309 RET recvfrom -1 errno 64 Host is down
In this case, wg_user_rcvthread mistakenly ignored the failing result
and blithely shoved the ssize_t -1 error indicator into
iov[1].iov_len and passed it on to rumpkern_recv_peer:
[34 lines not shown]
Merge tag 'bootconfig-fixes-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull bootconfig fix from Masami Hiramatsu:
- bootconfig: Fix NULL-pointer arithmetic
Fix undefined pointer arithmetic in xbc_snprint_cmdline() when
probing the buffer length with NULL and size 0. Track the written
length as a size_t instead to prevent build-time UBSan/FORTIFY_SOURCE
failures.
* tag 'bootconfig-fixes-v7.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
bootconfig: fix NULL-pointer arithmetic in xbc_snprint_cmdline()
nfs_nfsdserv.c: Fix setting of birthtime for some ZFS pools
Some ZFS pools do not support va_birthtime and will return
EINVAL when a VOP_SETATTR() of it is attempted. The MacOS
NFSv4 client sets va_birthtime (TimeCreate) in the same
Setattr with ctime/mtime and other attributes after a new
file is created. The EINVAL failure leaves these new files
messed up (mode == 0).
This patch pretends the setting of TimeCreate succeeded if
ctime/mtime were also set in the same Setattr RPC, which
resolves the problem for the MacOS client.
If this fix is not sufficient, a new pathconf name to detect
if a file system supports birthtime may be needed.
PR: 296066
(cherry picked from commit b1af05406b5117d76f567056fba0a023a6374465)
nfs_nfsdserv.c: Fix setting of birthtime for some ZFS pools
Some ZFS pools do not support va_birthtime and will return
EINVAL when a VOP_SETATTR() of it is attempted. The MacOS
NFSv4 client sets va_birthtime (TimeCreate) in the same
Setattr with ctime/mtime and other attributes after a new
file is created. The EINVAL failure leaves these new files
messed up (mode == 0).
This patch pretends the setting of TimeCreate succeeded if
ctime/mtime were also set in the same Setattr RPC, which
resolves the problem for the MacOS client.
If this fix is not sufficient, a new pathconf name to detect
if a file system supports birthtime may be needed.
PR: 296066
(cherry picked from commit b1af05406b5117d76f567056fba0a023a6374465)
[CIR] Implement Flexible Array Members for const-record lowering (#206564)
The previous patch I did rewrote the ConstRecordBuilder in a way that
resulted in flexible array members being an NYI. This was because it
requires quite a bit of additional work to accomplish this.
This patch does this implementation. It does so by: 1- Changing the CIR
dialect to just support them. If a struct type ends in a zero size
array, it allows constant initialization with a non-zero array size.
This patch adds this, as well as tests to do so.
2- Change our LowerToLLVM to detect this pattern, and substitute in the
struct-literal type. There is some additional work to allow us to do a
padded literal, which results in slightly more matches to classic
codegen. But otherwise, it is a pretty straight forward struct
replacement with a larger array type.
[clang] fix typo correction crash with template destructor names
Disables typo correction for template destructor names,
as typo correction is not aware of destructors and would
provide suugestions which would form an invalid name.
Since this fixes a regression that was never released, there are no release
notes.
Fixes #206992
[lldb] Harden PolicyStack against cross-thread Guard misuse (#195774)
Two related correctness/clarity improvements to the `Policy`
infrastructure introduced by 504a112:
`PolicyStack::Guard` now stores the std::thread::id of the thread that
created it. Destruction and move operations call
`llvm::report_fatal_error` when they happen on a different thread, since
the `PolicyStack` is `thread_local`: popping from the wrong thread would
silently corrupt that thread's stack.
`Push`/`Pop` on `PolicyStack` are now private. Callers go through named
factories (`PushPrivateState`, `PushPublicStateRunningExpression`) that
return RAII Guards. The transition factories on Policy
(`CreatePrivateState`, `CreatePublicStateRunningExpression`) inherit
from `PolicyStack::Get().Current()` and apply their named change on top,
so pushed policies preserve existing stack state rather than resetting
unrelated fields. `CreatePublicState` remains the baseline reference
value (returns a default `Policy{}`); the stack returns to public state
[13 lines not shown]
[clang] fix typo correction crash with template destructor names
Disables typo correction for template destructor names,
as typo correction is not aware of destructors and would
provide suugestions which would form an invalid name.
Since this fixes a regression that was never released, there are no release
notes.
Fixes #206992
wg-userspace(8): Drop <4-byte UDP packets immediately.
Same as the kernel already does. Add an assertion into
wg_receive_packets about this and a couple comments cross-referencing
wg_overudp_cb and wg_receive_packets.
And, while here, as a precaution in case the
inpcb_register_overudp_cb mechanism ever breaks down or gets
refactored, make wg_receive_packets drop <4-byte packets too -- this
path should be hit only when handling handshake packets, so adding
another predicted-not-taken branch here should cost essentially
nothing.
PR bin/60392: assertion "mbuflen >= sizeof(struct wg_msg)" failed
[CIR][NFC] Re-enable invalid linkage test (#205459)
The CIR verification test for a cir.global op with a missing linkage
attribute was broken by a change to the MLIR asm parser back in April.
At that time, I marked the test as XFAIL and added a check that would
prevent it from randomly passing. In the meantime, another MLIR parser
changed (https://github.com/llvm/llvm-project/pull/188008) fixed the
original problem.
This change reverts the test to its previous state since it now passes.
graphics/nvidia-drm-*-kmod*: Fix GPF in some configs
Fix General Protection Fault in __nv_drm_gem_nvkms_handle_vma_fault,
lkpi_vmf_insert_pnf_prot_locked, vm_page_busy_acquire in specific
configurations, notably KDE on Wayland.
PR: 296195
Reported by: keivan at motavalli.me
Reviewed by: ashafer
Tested by: keivan at motavalli.me
Differential Revision: https://reviews.freebsd.org/D57989
Co-authored by: ashafer at FreeBSD.org
[lldb-mcp] Link liblldb instead of the full initialization stack (#206852)
lldb-mcp linked liblldb but also pulled in lldbInitialization, which
drags in lldbCore and the entire plugin stack as a second, static copy
of LLDB alongside the dylib. It bootstrapped that copy through the
private SystemInitializerCommon.
lldb-mcp is a thin stdio proxy: it locates and forwards I/O to an lldb
subprocess and never creates a debugger. It only needs the FileSystem,
HostInfo, and Socket subsystems. Drop lldbInitialization, get the heavy
code from liblldb, and initialize just those subsystems directly (as
lldb-dap does) rather than via SystemInitializerCommon.
rdar://181054260
[clang][SYCL] Add -fsycl-device-image-split option (#206870)
Add the -fsycl-device-image-split= driver option to control how SYCL
device code is split into separate device images. Supported values:
- kernel: one device image per SYCL kernel
- translation_unit: one device image per translation unit
- link_unit: one device image per linking unit
The bare -fsycl-device-image-split flag is an alias for
-fsycl-device-image-split=translation_unit, which is also the default.
clang-sycl-linker module-split-mode option values were updated
accordingly to simplify options forwarding logic.
Co-Authored-By: Claude
[HLSL][DXIL] InterlockedOr and InterlockedOr64 builtins (#180804)
This includes the first phase of implementation of the InterlockedOr
intrinsic. This covers the usage of the intrinsic/builtin on
RWByteAddressBuffers, Typed Buffers, and Structured Buffers. Not covered
are textures, groupshared memory, and the standalone
InterlockedOr(buf[index], val, ret) intrinsics.
SPIRV implementation is not covered in this commit.
Contributes to, but does not address
https://github.com/llvm/llvm-project/issues/99126
[lldb] Find the default source file's main by base name (#207043)
SourceManager::GetDefaultFileAndLine locates the executable's main to
pick a default source file, used for input like "break set -l N" with no
file specified. It searched for main by full name, but a function's
linkage name can differ from its source name, in which case a full-name
search for "main" does not find it and no default file is chosen.
For example, wasi-libc renames main to __main_argc_argv, so on
WebAssembly the debug function for main was never matched and "break set
-l N" failed with "no default file available".
When we can't find "main", fall back to searching by base name.
[libc][realpath] Implement symbolic path resolution (#204467)
This PR contains an incremental implementation of `realpath` that just
simplifies path traversals (e.g. `"/a/./../b"` -> `"/b"`). The complete
implementation would perform `getcwd`/`statx`/`readlinkat` to actually
resolve symlinks, validate paths, etc. This PR aims to add as much
functionality/error handling as possible without making any syscalls.
This implementation lives in `libc/src/stdlib/linux/`, since follow-on
PRs will rely on linux-specific syscalls. For testing purposes, I've
added the entrypoint for x86-64 linux when
`LLVM_LIBC_ENABLE_EXPERIMENTAL_ENTRYPOINTS` is enabled.
Follow-on PRs to add: path validation (e.g.
paths must exist), support for cwd-relative paths, and symlink
resolution.