[orc-rt] Add ORC_RT_HAS_BUILTIN, stop defining __has_builtin (#220503)
orc-rt/support/Compiler.h supplied a fallback definition of
__has_builtin for compilers that lack it. __has_builtin is a reserved
identifier, and defining one from a public header can collide with the
compiler's own definition or with another library the client includes.
Replace it with ORC_RT_HAS_BUILTIN(X) in orc-rt-c/support/Compiler.h,
which wraps __has_builtin where it exists and expands to 0 otherwise,
and convert the five uses.
[clang][Sema] Allow null caller for HIP kernel launch in incremental mode (#218659)
This PR allows a HIP kernel to be launched without a caller in
incremental mode. This is necessary because in incremental
mode(clang-repl), there isn't a `main` or any function that calls the
kernel.
Also adds a Sema test that compiles a top-level HIP kernel launch in
incremental device mode and verifies it is accepted.
Assisted by Claude Opus 4.8
[CIR] Add RegionBranchOpInterface unit tests and fix cir.await successors
Five of the ten ops implementing RegionBranchOpInterface have no unit test
coverage: cir.case, cir.cleanup.scope, cir.global, cir.await and
cir.coro.body. Add tests for all five.
Covering cir.await exposes a disagreement with its own terminator.
cir.condition terminates the ready region and reports {resume, suspend} as
its successors when the parent is an await, but AwaitOp::getSuccessorRegions
listed all three regions as entry successors and reported the parent op as
the successor of every region exit. Fix it to match cir.condition: ready is
the only entry successor, exiting ready branches to resume or suspend, and
exiting suspend or resume returns to the parent operation.
cir.await declares no results and carries NoRegionArguments, so successor
operand and input counts stay at zero along every edge and the MLIR verifier
is unaffected.
[mlir][SCF] Handle dropped operands in structural type conversion (#220473)
SCF structural type conversion assumes that `scf.for` bounds and
`scf.if` conditions are converted to exactly one value. A 1:N conversion
can drop or split these operands, causing `getSingleElement` to trigger
an assertion.
Reject conversions with non-single-valued bounds or conditions and add
regression coverage.
Fixes: https://github.com/llvm/llvm-project/issues/220459
clang: Distinguish unspecified from disabled exception model
Add ExceptionHandlingKind::Default so clang can tell an unspecified
exception model from an explicit -exception-model=none.
clang: Emit "exception-model" module flag
Record the exception-handling model as an "exception-model" IR module
flag when it differs from the target triple's default, mirroring how
other target ABI properties are recorded. Adds a
CodeGenOptions::toExceptionHandling helper to translate clang's
ExceptionHandlingKind into the LLVM ExceptionHandling enum.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
IR: Introduce "exception-model" module flag
Add an "exception-model" IR module flag intended to replace
TargetOptions::ExceptionModel, such that the ABI is fully
computable from the IR alone. Add the basic documentation and
verifier/linker tests, but doesn't wire up the consumers.
The main thing I question is whether the single "wasm" model is
really the correct control. With the existing TargetOption,
WebAssembly is overloading "none" in a weird way that sometimes
means default, and sometimes mean forcibly disabled exceptions.
It additionally has -wasm-enable-eh and -wasm-enable-sjlj cl::opts
and I don't fully understand the interaction between all of these
knobs; the cl::opts are even worse than the TargetOptions since
these still change the ABI and are backend private.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
tests/sys/netinet/tcp_socket: fix build with ATF 0.22+
Confirm that creating clients/sockets was successful by testing the
result separate from the assignment and test that the return value is
not -1 instead of testing that the value returned is non-zero.
This fixes the build with [ATF 0.22+][1].
MFC after: 2 weeks
Reported by: clang (-Wparenthesis)
Reviewed by: tuexen, cc
Differential Revision: https://reviews.freebsd.org/D59284
[1]: https://github.com/freebsd/atf/pull/72
tests/sys/kern/ktls_test: fix -Wsign-compare issue
Cast the size_t quantity used in a comparison to off_t to mute a
`-Wsign-compare` complaint that now occurs after ATF 0.22 [1].
MFC after: 2 weeks
Reported by: clang
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D59285
[1]: https://github.com/freebsd/atf/pull/72
[GlobalOpt] Fix crash on self-referential global (#219777)
Fix crash in `GlobalOpt` when a global references itself (void *g = &g).
Collect users into a vector to avoid iterator invalidation.
Fixes: #219629
asn1_multi: rework creation of the returned stack
Currently, the ASN1_TYPE ret is created up front and further populated
via a possibly failing call to ASN1_STRING_type_new(). On failure, the
incomplete ret is returned, indicating success to the caller, which may
or may not fail later.
Instead, create the inner ASN1_STRING first, then the ASN1_TYPE. Use
setter API with proper ownership transfer rather than fiddling with
deeply nested ASN1 structures. This way we only succeed if everything
actually succeeded.
ok kenjiro
[orc-rt] Consolidate symbol export macros (#220495)
Replace the overlapping visibility macros with a single pair, one per
public API surface:
ORC_RT_C_EXPORT (orc-rt-c/support/Compiler.h) - the C API
ORC_RT_EXPORT (orc-rt/support/Compiler.h) - the C++ API
ORC_RT_C_ABI is renamed to ORC_RT_C_EXPORT. ORC_RT_INTERFACE,
ORC_RT_HIDDEN and ORC_RT_IMPORT are removed.
ORC_RT_EXPORT is currently defined as ORC_RT_C_EXPORT so that the
platform logic lives in one place. It becomes separately switchable once
there is an option to hide the C++ API.
No change to generated code: every macro expands to exactly what it did
before. The Windows dllexport/dllimport and static-build cases are left
as a TODO for the commit that adds the shared-library build.
asn1_multi: plug leak if sk_ASN1_TYPE_push() fails
If the push of typ onto sk fails, the exit path does not free it.
Fix that and avoid function nesting when calling ASN1_generate_v3().
Prompted by a similar fix in OpenSSL
ok kenjiro