Skip to content

[TargetVersion] Only enable on RISC-V and AArch64 #115991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ Attribute Changes in Clang
- Clang now supports ``[[clang::lifetime_capture_by(X)]]``. Similar to lifetimebound, this can be
used to specify when a reference to a function parameter is captured by another capturing entity ``X``.

- The ``target_version`` attribute is now only supported for AArch64 and RISC-V architectures.

Improvements to Clang's diagnostics
-----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -3297,7 +3297,7 @@ def Target : InheritableAttr {
}];
}

def TargetVersion : InheritableAttr {
def TargetVersion : DeclOrTypeAttr, TargetSpecificAttr<TargetArch<!listconcat(TargetAArch64.Arches, TargetRISCV.Arches)>> {
let Spellings = [GCC<"target_version">];
let Args = [StringArgument<"NamesStr">];
let Subjects = SubjectList<[Function], ErrorDiag>;
Expand Down
4 changes: 4 additions & 0 deletions clang/test/Sema/attr-target-version-unsupported.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s

//expected-warning@+1 {{unknown attribute 'target_version' ignored}}
int __attribute__((target_version("aes"))) foo(void) { return 3; }
Loading