36536 Commits

Author SHA1 Message Date
Yanzuo Liu
109040acec
[Clang][NFC] Enumerate Clang ABI versions in a separate header file (#151995)
Make it easier for us to add ABI versions.

Close #144332
2025-08-07 18:00:43 +08:00
erichkeane
26dde15ed4 [OpenACC] Add warning for VLAs in a private/firstprivate clause
private/firstprivate typically do copy operations, however copying a VLA
isn't really possible.  This patch introduces a warning to alert the
person that this copy isn't happening correctly.

As a future direction, we MIGHT consider doing additional work to make
sure they are initialized/copied/deleted/etc correctly.
2025-08-06 13:14:20 -07:00
erichkeane
b291d02a93 [OpenACC][NFCI] Add extra data to firstprivate recipe AST node
During implementation I found that I need some additional data in the
AST node for codegen, so this patch adds the second declaration
reference.
2025-08-06 10:18:34 -07:00
Steven Perron
fe0948c9a5
[HLSL][SPIRV] Add vk::binding attribute (#150957)
The vk::binding attribute allows users to explicitly set the set and
binding for a resource in SPIR-V without chaning the "register"
attribute, which will be used when targeting DXIL.

Fixes https://github.com/llvm/llvm-project/issues/136894
2025-08-05 21:00:06 -04:00
Stanislav Mekhanoshin
34aed0ed56
[AMDGPU] Add gfx1250 wmma_scale[16]_f32_32x16x128_f4 instructions (#152194) 2025-08-05 15:15:21 -07:00
zGoldthorpe
d7074b63ed
[Clang][AMDGPU] Add builtins for some buffer resource atomics (#149216)
This patch exposes builtins for atomic `add`, `max`, and `min` operations that
operate over buffer resource pointers.
2025-08-05 11:04:15 -06:00
erichkeane
258997c16e [OpenACC][NFCI] Add 'InitRecipes' to 'firstprivate' AST node
This patch adds the 'init recipes' to firstprivate like I did for
'private', so that we can properly init these types.  At the moment,
the recipe init isn't generated (just the VarDecl), and this isn't
really used anywhere as it will be used exclusively in Codegen.
2025-08-05 09:26:47 -07:00
erichkeane
16766b3aef Fix ms type_info to be a 'class' type
It was brought up on #151277 that the patch changes type_info from class
to struct. While I couldn't find a way to test/notice this, this patch
changes it to a class.

While I'm here, I am also removing unnecessary/against coding standard
curley brackets.
2025-08-05 07:16:07 -07:00
Corentin Jabot
f72b3e1c07
[Clang] Add detailed notes explaining why is_constructible evaluates to false (Revert 16d5db7) (#151935)
Adds explanation why `is_constructible` evaluates to false.

This reapplies as-is e476f968bc8e438a0435d10934f148de570db8eb.
This was reverted in 16d5db71b3c38f21aa17783a8758f947dca5883f because of
a test failure in libc++.

The test failure in libc++ is interesting in that, in the absence of
nested diagnostics a bunch of diagnostics are emitted as error instead
of notes, which we cannot silence with `-verify-ignore-unexpected`.

The fix here is to prevent the diagnostics to be emitted in the first
place.
However this is clearly not ideal and we should make sure to deploy a
better solution in the clang 22 time frame, in the lines of
https://discourse.llvm.org/t/rfc-add-a-new-text-diagnostics-format-that-supports-nested-diagnostics/87641/12

Fixes #150601

---------

Co-authored-by: Shamshura Egor <164661612+egorshamshura@users.noreply.github.com>
2025-08-05 10:51:26 +02:00
Stanislav Mekhanoshin
a153e83e41
[AMDGPU] gfx1250 v_wmma_scale[16]_f32_16x16x128_f8f6f4 codegen (#152036) 2025-08-04 19:16:34 -07:00
erichkeane
4e0b68cef0 [OpenACC] Implement warning restrictions for 'firstprivate'
'firstprivate' can't be generated unless we have a copy constructor, so
this patch implements the restriction as a warning, and prevents the
item from being added to the AST.
2025-08-04 11:42:33 -07:00
Erich Keane
66eadbb235
[OpenACC][CIR] Implement 'init' lowering for private clause vars (#151781)
Previously, #151360 implemented 'private' clause lowering, but didn't
properly initialize the variables. This patch adds that behavior to make
sure we correctly get the constructor or other init called.
2025-08-04 11:14:58 -07:00
Fraser Cormack
df74736732
[clang] Add the ability to link libclc OpenCL libraries (#146503)
This commit adds driver support for linking libclc OpenCL libraries. It
takes the form of a new optional flag: --libclc-lib=namespec. Nothing is
linked unless this flag is specified.

Not all libclc targets have corresponding clang targets. For this reason
it is desirable for users to be able to specify a libclc library name.
We support this by taking both a library name (without the .bc suffix)
or a filename. Both of these are searched for in the clang resource
directory. Filenames are
also checked themselves so that absolute paths can be provided. The
syntax for specifying filenames (as opposed to library names) uses a
leading colon (:), inspired by the -l option.

To accommodate this option, libclc libraries are now placed into clang's
resource directory in an in-tree configuration. The libraries are all
placed in <resource-dir>/lib/libclc and
are not grouped under host-specific directories as some other runtime
libraries are; it is not expected that OpenCL libraries will differ
depending on the host toolchain.

Currently only the AMDGPU toolchain supports this option as a proof of
concept. Other targets such as NVPTX or SPIR/SPIR-V could support it
too. We could optionally let target toolchains search for libclc
libraries themselves, possibly when passed an empty --libclc-lib.
2025-08-04 15:37:22 +01:00
Matt
2e404d1f80
clang: Make the type_info builtin declaration a singleton (#151277)
This fixes an ambiguous type type_info when you try and reference the
`type_info` type while using clang modulemaps with `-fms-compatibility`
enabled

Fixes #38400
2025-08-04 06:44:10 -07:00
Michael Buch
cd8f348c69
[clang][Attr] Remove 'literal label' form of AsmLabelAttr (#151858)
This was added purely for the needs of LLDB. However, starting with
https://github.com/llvm/llvm-project/pull/151355 and
https://github.com/llvm/llvm-project/pull/148877 we no longer create
literal AsmLabels in LLDB either. So this is unused and we can get rid
of it.

In the near future LLDB will want to add special support for mangling
`AsmLabel`s (specifically
https://github.com/llvm/llvm-project/pull/149827).
2025-08-04 14:34:45 +01:00
Endre Fülöp
a3d0c541eb
[clang][analyzer] Add StoreToImmutable checker (#150417)
This adds alpha.core.StoreToImmutable, a new alpha checker that detects
writes
to immutable memory regions, implementing part of SEI CERT Rule ENV30-C.
The
original proposal only handled global const variables, but this
implementation
extends it to also detect writes to:
- Local const variables
- String literals
- Const parameters and struct members
- Const arrays and pointers to const data

This checker is the continuation of the work started by zukatsinadze.
Discussion: https://reviews.llvm.org/D124244
2025-08-04 14:56:33 +02:00
Gergely Futo
1454db130a
[RISCV] Support resumable non-maskable interrupt handlers (#148134)
The `rnmi` interrupt attribute value has been added for the `Smrnmi`
extension.

---------

Co-authored-by: Sam Elliott <sam@lenary.co.uk>
2025-08-04 10:54:50 +02:00
Corentin Jabot
28ed57eda8
[Clang] Initial support for P2841 (Variable template and concept template parameters) (#150823)
This is a first pass at implementing
[P2841R7](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2841r7.pdf).

The implementation is far from complete; however, I'm aiming to do that
in chunks, to make our lives easier.

In particular, this does not implement
 - Subsumption
 - Mangling
- Satisfaction checking is minimal as we should focus on #141776 first
(note that I'm currently very stuck)

FTM, release notes, status page, etc, will be updated once the feature
is more mature. Given the state of the feature, it is not yet allowed in
older language modes.

Of note: 
- Mismatches between template template arguments and template template
parameters are a bit wonky. This is addressed by #130603
- We use `UnresolvedLookupExpr` to model template-id. While this is
pre-existing, I have been wondering if we want to introduce a different
OverloadExpr subclass for that. I did not make the change in this patch.
2025-08-04 08:51:22 +02:00
Connector Switch
8b7f81f2de
[NFC] Fix assignment typo. (#151864) 2025-08-03 22:32:00 +08:00
Stanislav Mekhanoshin
d18511e10a
[AMDGPU] v_cvt_scalef32_sr_pk16_* gfx1250 instructions (#151810) 2025-08-02 15:21:59 -07:00
Stanislav Mekhanoshin
bc463c059c
[AMDGPU] v_cvt_scalef32_pk16_* gfx1250 instructions (#151807) 2025-08-02 12:42:12 -07:00
Stanislav Mekhanoshin
7598c25b5a
[AMDGPU] v_cvt_scale_pk16 gfx1250 instructions (#151804) 2025-08-02 10:45:02 -07:00
Stanislav Mekhanoshin
0988510ad4
[AMDGPU] gfx1250 v_perm_pk16_* instructions (#151773) 2025-08-01 20:12:35 -07:00
Stanislav Mekhanoshin
cc3932bf29
[AMDGPU] gfx1250 v_cvt_scalef32_sr_pk8_* instructions (#151765) 2025-08-01 19:25:57 -07:00
James Y Knight
4205da0f13
NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151782)
This commit handles the following types:
- clang::ExternalASTSource
- clang::TargetInfo
- clang::ASTContext
- clang::SourceManager
- clang::FileManager

Part of cleanup #151026
2025-08-01 22:23:30 -04:00
Stanislav Mekhanoshin
962ee7a568
[AMDGPU] gfx1250 v_cvt_scalef32_pk8_* instructions (#151758) 2025-08-01 18:29:45 -07:00
Stanislav Mekhanoshin
33abf05af4
[AMDGPU] gfx1250 v_permlane_* instructions (#151749) 2025-08-01 16:14:19 -07:00
Andy Kaylor
c188e1db6a
[CIR] Add vptr type and generate vptr field when needed (#151377)
This adds a new CIR type, cir.vptr, and generates a field of that type
when a record is declared that requires a vptr member.
2025-08-01 12:10:04 -07:00
Henrich Lauko
4820b183a8
[CIR] Simplify ConstantOp accesses and its getDefiningOp (#151216)
- Replaces  dyn_cast<cir::ConstantOp>(v.getDefiningOp()) and similar with v.getDefiningOp<cir::ConstantOp>()
- Adds `getValueAttr` method to ConstantOp
2025-08-01 21:04:54 +02:00
Andy Kaylor
a304e09fe7
[CIR] Handle expression with cleanups (#151600)
This adds code to handle expressions with cleanup, including
materializing a temporary object for the expression.
2025-08-01 11:38:35 -07:00
Andy Kaylor
96d1571a2f
[CIR] Add diagnostic for NYI AST visitor handlers (#151561)
A couple of handlers that were missing from the CIRGenerator AST visitor
allowed important features to be silently ignored during CIR generation.
This change adds these handlers with diagnostics to report that they are
not yet handled (except in the case where only debug information is
missed).
2025-08-01 09:29:00 -07:00
Paul Walker
3d7a3a1ef4 [NFC][arm_sve.td] Remove StructLoad/Store classes and improve tabification. 2025-08-01 13:37:34 +00:00
Timm Baeder
d8ca85a184
[clang][ExprConst] Remove Loc param (#151461)
The Loc param to these functions was weird and not always set in error
cases. It wasn't reliable to use.

This was almost entirely unused inside of clang and the one call site
that used the returned source location doesn't make a difference in
practice.
2025-08-01 14:09:06 +02:00
Stanislav Mekhanoshin
c7bb105e97
[AMDGPU] Add v_cvt_scale_pk8_* gfx1250 instructions (#151616) 2025-07-31 18:55:59 -07:00
Tom Honermann
9de4e062d7
[SYCL] Restrict the sycl_kernel_entry_point attribute spelling to C++11 style. (#151405)
Previously, the `sycl_kernel_entry_point` attribute could be specified
using either the GNU or C++11 spelling styles. Future SYCL attributes
are expected to support only the C++11 spelling style, so support for
the GNU style is being removed.

In order to ensure consistent presentation of the attribute in
diagnostic messages, diagnostics specific to this attribute now require
the attribute to be provided as an argument. This delegates formatting
of the attribute name to the diagnostic engine.

As an additional nicety, "the" is added to some diagnostic messages so
that they read more like proper sentences.
2025-07-31 19:25:05 -04:00
Stanislav Mekhanoshin
49d89bc9f4
[AMDGPU] Add gfx1250 cvt_pk|sr_fp8|bf8_f32 instructions (#151595) 2025-07-31 16:04:46 -07:00
Artem Belevich
507b879b6e
[CUDA] add support for targeting sm_103/sm_121 with CUDA-12.9 (#151587) 2025-07-31 13:38:54 -07:00
Stanislav Mekhanoshin
e46d938ddf
[AMDGPU] v_cvt_sr_pk_f16_f32 gfx1250 instruction (#151482) 2025-07-31 12:25:55 -07:00
James Y Knight
c7f3437507
NFC: Clean up of IntrusiveRefCntPtr construction from raw pointers. (#151545)
Handles clang::DiagnosticsEngine and clang::DiagnosticIDs.

For DiagnosticIDs, this mostly migrates from `new DiagnosticIDs` to
convenience method `DiagnosticIDs::create()`.

Part of cleanup https://github.com/llvm/llvm-project/issues/151026
2025-07-31 15:07:35 -04:00
Amr Hesham
03e54a148f
[CIR] Upstream MulOp for ComplexType (#150834)
This change adds support for mul op for ComplexType

https://github.com/llvm/llvm-project/issues/141365
2025-07-31 19:16:42 +02:00
Morris Hafner
8a5d363123
[CIR] Upstream support for function-level variable decompositions (#151073)
This implements support for structured bindings on a function scope
level. It does not add support for global structured bindings.
2025-07-31 17:34:41 +02:00
Kazu Hirata
c923d968b3
[Basic] Remove deprecated methods in CustomizableOptional (#151444)
This patch removes deprecated methods in CustomizableOptional.

These methods come from llvm::Optional, which later got renamed to
CustomizableOptional.  Since CustomizableOptional is used only in
OptionalDirectoryEntryRef and OptionalFileEntryRef, we do not need to
have full std::optional-like support in CustomizableOptional.
2025-07-31 07:31:30 -07:00
James Y Knight
9ddbb478ce
NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for llvm::vfs::FileSystem. (#151407)
This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new
object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>`
instead of `FileSystem*` or `FileSystem&`, when dealing with existing
objects.

Part of cleanup #151026.
2025-07-31 09:57:13 -04:00
Stanislav Mekhanoshin
ce40863209
[AMDGPU] Add v_cvt_sr|pk_bf8|fp8_f16 gfx1250 instructions (#151415) 2025-07-30 17:24:45 -07:00
Stanislav Mekhanoshin
62187a60e6
[AMDGPU] Add gfx1250 v_cvt_sr_pk_bf16_f32 instruction (#151385) 2025-07-30 14:02:03 -07:00
Hood Chatham
8dd91996f0
[WebAssembly] Add gc target feature to addBleedingEdgeFeatures (#151294)
Also alphebetize feature list, add `-mgc` and `-mno-gc` flags, and add
some missing feature tests.

Reland of #151107.

https://github.com/llvm/llvm-project/pull/150201#discussion_r2237982637
2025-07-30 13:04:02 -07:00
Kazu Hirata
b90e1e186b
[AST] Remove an unnecessary cast (NFC) (#151278)
getSignificantBits() already returns unsigned.
2025-07-30 07:29:49 -07:00
Donát Nagy
eca29aa0f1
[analyzer] Conversion to CheckerFamily: StackAddrEscapeChecker (#151136)
This commit converts the class StackAddrEscapeChecker to the checker
family framework and slightly simplifies the implementation.

This commit is almost NFC, the only technically "functional" change is
that it removes the hidden modeling checker `core.StackAddrEscapeBase`
which was only relevant as an implementation detail of the old checker
registration procedure.
2025-07-30 14:04:55 +02:00
Donát Nagy
1d6e68e63a
[analyzer] Conversion to CheckerFamily: NSOrCFErrorDerefChecker (#151171)
This commit converts the class `NSOrCFErrorDerefChecker` to the checker
family framework and simplifies some parts of the implementation (e.g.
removes two very trivial subclasses of `BugType`).

This commit is almost NFC, the only technically "functional" change is
that it removes the hidden modeling checker `NSOrCFErrorDerefChecker`
which was only relevant as an implementation detail of the old checker
registration procedure.
2025-07-30 13:54:59 +02:00
Nikita Popov
984ec02236
[Clang] Replace include with forward declaration (NFC) (#151292)
After https://github.com/llvm/llvm-project/pull/142541.
2025-07-30 12:18:38 +02:00