1634 Commits

Author SHA1 Message Date
Aaron Ballman
4ca9a4bb35 [[gnu::nonstring]] should work on pointers too (#150974)
Clang's current implementation only works on array types, but GCC (which
is where we got this attribute) supports it on pointers as well as
arrays.

Fixes #150951

(cherry picked from commit 837b2d464ff16fe0d892dcf2827747c97dd5465e)
2025-08-01 08:55:21 +02:00
zebullax
e35b01da11
[clang] Build argument string for clang::warn_unused_result (#148090)
Preserve the argument-clause for `warn-unused-result` when under clang::
scope.
We are not touching gnu:: scope for now as it's an error for GCC to have
that string. Personally I think it would be ok to relax it here too as
we are not introducing breakage to currently passing code, but feedback
is to go slowly about it.
2025-07-14 09:54:24 -04:00
Corentin Jabot
afffa0d334
[Clang] Do not emit -Wmissing-noreturn when [[noreturn]] is present (#148552)
Fix a false positve warning which was introduced by #146234.
2025-07-14 14:20:00 +02:00
Aaron Ballman
ea65415f31 Remove some FIXMEs that no longer apply; NFC
Noticed these while doing a review on changes in the area, but C23
added support for nodiscard with a message, so it's not an extension
we need to diagnose.
2025-07-11 07:41:51 -04:00
Oleksandr T.
2e8e254d18
[Clang] include attribute scope in diagnostics (#144619)
This patch updates diagnostics to print fully qualified attribute names,
including scope when present.
2025-07-08 11:36:52 +03:00
Samarth Narang
1cdc7f8724
[clang] [Sema] Suggest [[noreturn]] for void functions that always throw (#146234)
Implements https://github.com/llvm/llvm-project/issues/146223.
2025-06-30 10:46:51 -04:00
Samarth Narang
794edd187c
[clang] Suppress noreturn warning if last statement in a function is a throw (#145166)
Fixes https://github.com/llvm/llvm-project/issues/144952
2025-06-27 10:52:22 -04:00
Steven Perron
01d648a429
[HLSL][SPIRV] Reapply "[HLSL][SPIRV] Add vk::constant_id attribute." (#144902)
- **Reapply "[HLSL][SPIRV] Add vk::constant_id attribute." (#144812)**
- **Fix memory leak.**
2025-06-19 11:52:55 -04:00
Steven Perron
5f69d680e2
Revert "[HLSL][SPIRV] Add vk::constant_id attribute." (#144812)
Reverts llvm/llvm-project#143544
2025-06-18 19:30:43 -04:00
Steven Perron
acde20b560
[HLSL][SPIRV] Add vk::constant_id attribute. (#143544)
The vk::constant_id attribute is used to indicate that a global const
variable
represents a specialization constant in SPIR-V. This PR adds this
attribute to clang.

The documentation for the attribute is
[here](https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/SPIR-V.rst#specialization-constants).

The strategy is to to modify the initializer to get the value of a
specialize constant for a builtin defined in the SPIR-V backend.

Implements https://github.com/llvm/wg-hlsl/pull/287

Fixes https://github.com/llvm/llvm-project/issues/142448

---------

Co-authored-by: Nathan Gauër <github@keenuts.net>
2025-06-18 06:39:52 -04:00
Kazu Hirata
c01532177f
[clang] Remove unused includes (NFC) (#144285)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-06-15 21:00:36 -07:00
Kazu Hirata
f71fb2dc01
[clang] Use StringRef in range-based for loops (NFC) (#144242)
When we iterate over std::vector<std::string>, we can directly assign
each element to StringRef.  We do not need to go through separate
statements.
2025-06-15 21:00:22 -07:00
Oleksandr T.
0ff95c9eb1
[Clang] add fix-it hints for unknown attributes (#141305)
This patch adds fix-it hints for unknown attribute names when Clang
suggests a correction
2025-06-15 00:01:25 +03:00
Nathan Gauër
50f534e21c
[HLSL][SPIR-V] Handle SV_Position builtin in PS (#141759)
This commit is using the same mechanism as vk::ext_builtin_input to
implement the SV_Position semantic input.
The HLSL signature is not yet ready for DXIL, hence this commit only
implements the SPIR-V side.

This is incomplete as it doesn't allow the semantic on hull/domain and
other shaders, but it's a first step to validate the overall
input/output
semantic logic.

Fixes https://github.com/llvm/llvm-project/issues/136969
2025-06-11 14:22:54 +02:00
Cyndy Ishida
88f041f3e0
[clang][Darwin] Align all OS Versions for 26 (#143548)
* Translate the following versions to 26.
  * watchOS 12 -> 26
  * visionOS 3 -> 26
  * macos 16 -> 26
  * iOS 19 -> 26
  * tvOS 19 -> 26

* Emit diagnostics, but allow conversion when clients attempt to use
invalid gaps in OS versioning in availability.

* For target-triples, only allow "valid" versions for implicit
conversions.
2025-06-10 09:50:46 -07:00
Nick Sarnie
3b9ebe9201
[clang] Simplify device kernel attributes (#137882)
We have multiple different attributes in clang representing device
kernels for specific targets/languages. Refactor them into one attribute
with different spellings to make it more easily scalable for new
languages/targets.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-06-05 14:15:38 +00:00
PiJoules
b194cf1e40
[clang] Function type attribute to prevent CFI instrumentation (#135836)
This introduces the attribute discussed in

https://discourse.llvm.org/t/rfc-function-type-attribute-to-prevent-cfi-instrumentation/85458.

The proposed name has been changed from `no_cfi` to
`cfi_unchecked_callee` to help differentiate from `no_sanitize("cfi")`
more easily. The proposed attribute has the following semantics:

1. Indirect calls to a function type with this attribute will not be
instrumented with CFI. That is, the indirect call will not be checked.
Note that this only changes the behavior for indirect calls on pointers
to function types having this attribute. It does not prevent all
indirect function calls for a given type from being checked.
2. All direct references to a function whose type has this attribute
will always reference the true function definition rather than an entry
in the CFI jump table.
3. When a pointer to a function with this attribute is implicitly cast
to a pointer to a function without this attribute, the compiler will
give a warning saying this attribute is discarded. This warning can be
silenced with an explicit C-style cast or C++ static_cast.
2025-06-04 11:19:26 -07:00
Nathan Gauër
20d70196c9
[HLSL][SPIR-V] Implement vk::ext_builtin_input attribute (#138530)
This variable attribute is used in HLSL to add Vulkan specific builtins
in a shader.
The attribute is documented here:

17727e88fd/proposals/0011-inline-spirv.md

Those variable, even if marked as `static` are externally initialized by
the pipeline/driver/GPU. This is handled by moving them to a specific
address space `hlsl_input`, also added by this commit.

The design for input variables in Clang can be found here:
355771361e/proposals/0019-spirv-input-builtin.md


Co-authored-by: Justin Bogner <mail@justinbogner.com>
2025-06-04 13:22:37 +02:00
Ami-zhang
06f779b69d
Reland "[Clang][LoongArch] Support target attribute for function" (#142546)
This relands #140700. I have updated the test case('targetattr.c') to
resolve the test failure.

Original PR resulted in test fail:
https://lab.llvm.org/buildbot/#/builders/11/builds/16173
https://lab.llvm.org/buildbot/#/builders/202/builds/1531

Original description:
Followup to #140700.
2025-06-03 15:57:50 +08:00
Alexandros Lamprineas
b3fd2ea888
[Clang][FMV] Stop emitting implicit default version using target_clones. (#141808)
With the current behavior the following example yields a linker error:
"multiple definition of `foo.default'"

// Translation Unit 1
__attribute__((target_clones("dotprod, sve"))) int foo(void) { return 1; }

// Translation Unit 2
int foo(void) { return 0; }
__attribute__((target_version("dotprod"))) int foo(void);
__attribute__((target_version("sve"))) int foo(void);
int bar(void) { return foo(); }

That is because foo.default is generated twice. As a user I don't find
this particularly intuitive. If I wanted the default to be generated in
TU1 I'd rather write target_clones("dotprod, sve", "default")
explicitly.

When changing the code I noticed that the RISC-V target defers the
resolver emission when encountering a target_version definition. This
seems accidental since it only makes sense for AArch64, where we only
emit a resolver once we've processed the entire TU, and only if the
default version is present. I've changed this so that RISC-V immediately
emmits the resolver. I adjusted the codegen tests since the functions
now appear in a different order.

Implements https://github.com/ARM-software/acle/pull/377
2025-06-02 11:04:00 +01:00
Aaron Ballman
0adf6e8d33
Work around a build issue with MSVC; NFC (#142195)
Microsoft helpfully defines `THIS` to `void` in two different platform
SDK headers, at least one of which is reachable via <Windows.h>. We have
a user who ran into a build because of `THIS` unfortunate macro name
collision.

Rename the members to better match our naming conventions.

Fixes #142186
2025-05-31 08:35:26 -04:00
Paul Kirth
d93788fcbf
Revert "[Clang][LoongArch] Support target attribute for function" (#141998)
Reverts llvm/llvm-project#140700

This breaks bots both in buildbot and downstream CI: 
- https://lab.llvm.org/buildbot/#/builders/11/builds/16173
- https://lab.llvm.org/buildbot/#/builders/202/builds/1531
-
https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-host-linux-x64/b8713537585914796017/overview
2025-05-29 11:26:44 -07:00
Victor Lomuller
c474f8f240
[clang][SPIRV] Add builtin for OpGenericCastToPtrExplicit and its SPIR-V friendly binding (#137805)
The patch introduce __builtin_spirv_generic_cast_to_ptr_explicit which
is lowered to the llvm.spv.generic.cast.to.ptr.explicit intrinsic.

The SPIR-V builtins are now split into 3 differents file:
BuiltinsSPIRVCore.td,
BuiltinsSPIRVVK.td for Vulkan specific builtins, BuiltinsSPIRVCL.td for
OpenCL specific builtins
and BuiltinsSPIRVCommon.td for common ones.

The patch also introduces a new header defining its SPIR-V friendly
equivalent (__spirv_GenericCastToPtrExplicit_ToGlobal,
__spirv_GenericCastToPtrExplicit_ToLocal and
__spirv_GenericCastToPtrExplicit_ToPrivate). The functions are declared
as aliases to the new builtin allowing C-like languages to have a
definition to rely on as well as gaining proper front-end diagnostics.

The motivation for the header is to provide a stable binding for
applications or library (such as SYCL) and allows non SPIR-V targets to
provide an implementation (via libclc or similar to how it is done for
gpuintrin.h).
2025-05-29 15:19:40 +02:00
Ami-zhang
b359422eeb
[Clang][LoongArch] Support target attribute for function (#140700)
This adds support under LoongArch for the target("..") attributes.

The supported formats are:
- "arch=<arch>" strings, that specify the architecture features for a
function as per the -march=arch option.
- "tune=<cpu>" strings, that specify the tune-cpu cpu for a function as
per -mtune.
- "<feature>", "no-<feature>" enabled/disables the specific feature.
2025-05-29 19:54:48 +08:00
Marco Elver
c7ccfc6dfc
Thread Safety Analysis: Support reentrant capabilities (#137133)
Introduce the `reentrant_capability` attribute, which may be specified
alongside the `capability(..)` attribute to denote that the defined
capability type is reentrant. Marking a capability as reentrant means
that acquiring the same capability multiple times is safe, and does not
produce warnings on attempted re-acquisition.

The most significant changes required are plumbing to propagate if the
attribute is present to a CapabilityExpr, and introducing
ReentrancyDepth to the LockableFactEntry class.
2025-05-26 17:03:55 +02:00
Kazu Hirata
12af64d0d7
[Sema] Remove unused includes (NFC) (#141419)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-05-25 10:55:32 -07:00
Oleksandr T.
50127ac054
[Clang] add typo correction for unknown attribute names (#140629)
This patch enhances Clang's diagnosis for unknown attributes by
providing typo correction suggestions for known attributes.

```cpp
[[gmu::deprected]] // expected-warning {{unknown attribute 'gmu::deprected' ignored; did you mean 'gnu::deprecated'?}}
int f1(void) {
  return 0;
}

[[deprected]] // expected-warning {{unknown attribute 'deprected' ignored; did you mean 'deprecated'?}}
int f2(void) {
  return 0;
}
```
2025-05-22 17:03:32 +03:00
Daan De Meyer
32946ddd2e
[clang-include-cleaner] Make cleanup attr report expr location (#140233)
Instead of reporting the location of the attribute, let's report the
location of the function reference that's passed to the cleanup
attribute as the first argument. This is required as the attribute might
be coming from a macro which means clang-include-cleaner skips the use
as it gets attributed to the header file declaringt the macro and not to
the main file.

To make this work, we have to add a fake argument to the CleanupAttr
constructor so we can pass in the original Expr alongside the function
declaration.

Fixes #140212
2025-05-21 16:40:30 +02:00
Kazu Hirata
f9f69dac2a
[clang] Remove redundant control flow statements (NFC) (#140359) 2025-05-17 12:59:47 -07:00
Finn Plummer
dd3d7cfe2e
[HLSL][RootSignature] Define and integrate rootsig clang attr and decl (#137690)
- Defines a new declaration node `HLSLRootSignature` in `DeclNodes.td`
that will consist of a `TrailingObjects` of the in-memory construction
of the root signature, namely an array of `hlsl::rootsig::RootElement`s

- Defines a new clang attr `RootSignature` which simply holds an
identifier to a corresponding root signature declaration as above

- Integrate the `HLSLRootSignatureParser` to construct the decl node in
`ParseMicrosoftAttributes` and then attach the parsed attr with an
identifier to the entry point function declaration.

- Defines the various required declaration methods

- Add testing that the declaration and reference attr are created
correctly, and some syntactical error tests.

It was previously proposed that we could have the root elements
reference be stored directly as an additional member of the attribute
and to not have a separate root signature decl. In contrast, by defining
them separately as this change proposes, we will allow a unique root
signature to have its own declaration in the AST tree. This allows us to
only construct a single root signature for all duplicate root signature
attributes. Having it located directly as a declaration might also prove
advantageous when we consider root signature libraries.

Resolves https://github.com/llvm/llvm-project/issues/119011
2025-05-12 09:59:46 -07:00
Oleksandr T.
61b435ec4d
[Clang] show attribute namespace in diagnostics (#138519)
This patch enhances Clang's diagnosis of an unknown attribute by
printing the attribute's namespace in the diagnostic text. e.g.,

```cpp
[[foo::nodiscard]] int f(); // warning: unknown attribute 'foo::nodiscard' ignored
```
2025-05-09 00:49:01 +03:00
Prabhu Rajasekaran
20d6375796
[clang] Handle CC attrs for UEFI (#138935)
UEFI's default ABI is MS ABI. Handle the calling convention attributes
accordingly.
2025-05-07 21:42:01 -07:00
Kazu Hirata
f002f300c5
[clang] Remove unused local variables (NFC) (#138453) 2025-05-04 10:51:40 -07:00
Vlad Serebrennikov
7e71db8463 [clang][NFC] Convert Sema::AvailabilityMergeKind to scoped enum 2025-05-02 07:56:57 +03:00
Vlad Serebrennikov
001cc34275
[clang] Add scoped enum support to StreamingDiagnostic (#138089)
This patch adds templated `operator<<` for diagnostics that pass scoped
enums, saving people from `llvm::to_underlying()` clutter on the side of
emitting the diagnostic. This eliminates 80 out of 220 usages of
`llvm::to_underlying()` in Clang.

I also backported `std::is_scoped_enum_v` from C++23.
2025-05-01 17:03:47 +04:00
Aaron Ballman
e8ae779471
[C] Add diagnostic + attr for unterminated strings (#137829)
This introduces three things related to intialization like:

char buf[3] = "foo";

where the array does not declare enough space for the null terminator
but otherwise can represent the array contents exactly.

1) An attribute named 'nonstring' which can be used to mark that a
   field or variable is not intended to hold string data.

2) -Wunterminated-string-initialization, which is grouped under
   -Wextra, and diagnoses the above construct unless the declaration
   uses the 'nonstring' attribute.

3) -Wc++-unterminated-string-initialization, which is grouped under
   -Wc++-compat, and diagnoses the above construct even if the
   declaration uses the 'nonstring' attribute.

Fixes #137705
2025-04-30 10:14:18 -04:00
halbi2
6dfd354571
[clang] ownership_returns attribute takes no more than 2 arguments (#137897) 2025-04-30 19:29:37 +08:00
Vlad Serebrennikov
12a4ec6b1a [clang][NFC] Convert Sema::FormatStringType to scoped enum 2025-04-28 13:54:26 +03:00
Aaron Ballman
15321d2c9e
[C] Add (new) -Wimplicit-void-ptr-cast to -Wc++-compat (#136855)
This introduces a new diagnostic group (-Wimplicit-void-ptr-cast),
grouped under -Wc++-compat, which diagnoses implicit conversions from
void * to another pointer type in C. It's a common source of
incompatibility with C++ and is something GCC diagnoses (though GCC does
not have a specific warning group for this).

Fixes #17792
2025-04-24 06:37:11 -04:00
Benson Chu
50320504c8 [ARM][Thumb] Save FPSCR + FPEXC for save-vfp attribute
FPSCR and FPEXC will be stored in FPStatusRegs, after GPRCS2 has been
saved.

- GPRCS1
- GPRCS2
- FPStatusRegs (new)
- DPRCS
- GPRCS3
- DPRCS2

FPSCR is present on all targets with a VFP, but the FPEXC register is
not present on Cortex-M devices, so different amounts of bytes are
being pushed onto the stack depending on our target, which would
affect alignment for subsequent saves.

DPRCS1 will sum up all previous bytes that were saved, and will emit
extra instructions to ensure that its alignment is correct. My
assumption is that if DPRCS1 is able to correct its alignment to be
correct, then all subsequent saves will also have correct alignment.

Avoid annotating the saving of FPSCR and FPEXC for functions marked
with the interrupt_save_fp attribute, even though this is done as part
of frame setup.  Since these are status registers, there really is no
viable way of annotating this. Since these aren't GPRs or DPRs, they
can't be used with .save or .vsave directives. Instead, just record
that the intermediate registers r4 and r5 are saved to the stack
again.

Co-authored-by: Jake Vossen <jake@vossen.dev>
Co-authored-by: Alan Phipps <a-phipps@ti.com>
2025-04-22 14:31:29 -05:00
Kazu Hirata
f2ec5e40d9
[clang] Use llvm::unique (NFC) (#136469) 2025-04-19 20:33:53 -07:00
Nick Sarnie
257b727584
[clang][Sema][SYCL] Fix MSVC STL usage on AMDGPU (#135979)
The MSVC STL includes specializations of `_Is_memfunptr` for every
function pointer type, including every calling convention.

The problem is the AMDGPU target doesn't support the x86 `vectorcall`
calling convention so clang sets it to the default CC. This ends up
clashing with the already-existing overload for the default CC, so we
get a duplicate definition error when including `type_traits` (which we
heavily use in the SYCL STL) and compiling for AMDGPU on Windows.

This doesn't happen for pure AMDGPU non-SYCL because it doesn't include
the C++ STL, and it doesn't happen for CUDA/HIP because a similar
workaround was done
[here](fa49c3a888).

I am not an expert in Sema, so I did a kinda of hardcoded fix, please
let me know if there is a better way to fix this.

As far as I can tell we can't do exactly the same fix that was done for
CUDA because we can't differentiate between device and host code so
easily.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-04-18 15:28:46 +00:00
yronglin
d83b639b4c
Reland [clang] Unify SourceLocation and IdentifierInfo* pair-like data structures to IdentifierLoc (#136077)
This PR reland https://github.com/llvm/llvm-project/pull/135808, fixed
some missed changes in LLDB.
I found this issue when I working on
https://github.com/llvm/llvm-project/pull/107168.

Currently we have many similiar data structures like:
- std::pair<IdentifierInfo *, SourceLocation>.
- Element type of ModuleIdPath.
- IdentifierLocPair.
- IdentifierLoc.

This PR unify these data structures to IdentifierLoc, moved
IdentifierLoc definition to SourceLocation.h, and deleted other similer
data structures.

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2025-04-17 22:40:47 +08:00
Michael Buch
99c08ff1cb
Revert "[clang] Unify SourceLocation and IdentifierInfo* pair-like data structures to IdentifierLoc" (#135974)
Reverts llvm/llvm-project#135808

Example from the LLDB macOS CI:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/24084/execution/node/54/log/?consoleFull
```
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp:360:49: error: no viable conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'clang::ModuleIdPath' (aka 'ArrayRef<IdentifierLoc>')
  clang::Module *top_level_module = DoGetModule(clang_path.front(), false);
                                                ^~~~~~~~~~~~~~~~~~
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:41:40: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'const llvm::ArrayRef<clang::IdentifierLoc> &' for 1st argument
  class LLVM_GSL_POINTER [[nodiscard]] ArrayRef {
                                       ^
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:41:40: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'llvm::ArrayRef<clang::IdentifierLoc> &&' for 1st argument
/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:70:18: note: candidate constructor not viable: no known conversion from 'std::pair<clang::IdentifierInfo *, clang::SourceLocation>' to 'std::nullopt_t' for 1st argument
    /*implicit*/ ArrayRef(std::nullopt_t) {}
```
2025-04-16 17:05:53 +02:00
yronglin
d3153ad66c
[clang] Unify SourceLocation and IdentifierInfo* pair-like data structures to IdentifierLoc (#135808)
I found this issue when I working on
https://github.com/llvm/llvm-project/pull/107168.

Currently we have many similiar data structures like:
 - `std::pair<IdentifierInfo *, SourceLocation>`.
 - Element type of `ModuleIdPath`.
 - `IdentifierLocPair`.
 - `IdentifierLoc`.
 
This PR unify these data structures to `IdentifierLoc`, moved
`IdentifierLoc` definition to SourceLocation.h, and deleted other
similer data structures.

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2025-04-16 20:53:25 +08:00
Aaron Puchert
9c73eba8aa
Merge similar Clang Thread Safety attributes (#135561)
Some of the old lock-based and new capability-based spellings behave
basically in the same way, so merging them simplifies the code
significantly.

There are two minor functional changes: we only warn (instead of an
error) when the try_acquire_capability attribute is used on something
else than a function. The alternative would have been to produce an
error for the old spelling, but we seem to only warn for all function
attributes, so this is arguably more consistent.

The second change is that we also check the first argument (which is the
value returned for a successful try-acquire) for `this`. But from what I
can tell, this code is defunct anyway at the moment (see #31414).
2025-04-15 23:21:34 +02:00
Aaron Ballman
543e5f5842
Fix crash with align_value diagnostic reporting (#135013)
We were passing the address of a local variable to a call to Diag()
which then tried to use the object after its lifetime ended, resulting
in crashes. We no longer pass the temporary object any longer.

Fixes #26612
2025-04-09 12:39:03 -04:00
Aaron Ballman
a2d983cffb
Improve diagnostic wording for invalid callback attribute uses (#134423)
We were previously telling the user how many arguments were passed to
the attribute rather than saying how many arguments were expected to be
passed to the callback function. This rewords the diagnostic to
hopefully be a bit more clear.

Fixes #47451
2025-04-04 15:01:36 -04:00
Finn Plummer
73e8d67a20
Revert "[HLSL][RootSignature] Define and integrate HLSLRootSignatureAttr" (#134273)
Reverts llvm/llvm-project#134124

The build is failing again to a linking error:
[here](https://github.com/llvm/llvm-project/pull/134124#issuecomment-2776370486).
Again the error was not present locally or any of the pre-merge builds
and must have been transitively linked in these build environments...
2025-04-03 09:40:50 -07:00
Finn Plummer
65fa57bdcc
[HLSL][RootSignature] Define and integrate HLSLRootSignatureAttr (#134124)
- Defines HLSLRootSignature Attr in `Attr.td`
- Define and implement handleHLSLRootSignature in `SemaHLSL`
- Adds sample test case to show AST Node is generated in
`RootSignatures-AST.hlsl`

This commit will "hook-up" the seperately defined RootSignature parser
and invoke it to create the RootElements, then store them on the
ASTContext and finally store the reference to the Elements in
RootSignatureAttr

Resolves https://github.com/llvm/llvm-project/issues/119011

---------

Co-authored-by: Finn Plummer <finnplummer@microsoft.com>
2025-04-03 09:27:54 -07:00