Skip to content

Commit c049732

Browse files
authored
[clang] Fix crash when diagnosing unsupported attributes (#150333)
In #141305, the attribute argument was (unintentionally) removed from the diagnostic emission. Fixes #150237
1 parent e9de32f commit c049732

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,7 +2041,8 @@ bool Sema::CheckAttrTarget(const ParsedAttr &AL) {
20412041
// Check whether the attribute is valid on the current target.
20422042
if (!AL.existsInTarget(Context.getTargetInfo())) {
20432043
if (AL.isRegularKeywordAttribute())
2044-
Diag(AL.getLoc(), diag::err_keyword_not_supported_on_target);
2044+
Diag(AL.getLoc(), diag::err_keyword_not_supported_on_target)
2045+
<< AL << AL.getRange();
20452046
else
20462047
DiagnoseUnknownAttribute(AL);
20472048
AL.setInvalid();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: %clang_cc1 -x c -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
2+
3+
void arm_streaming(void) __arm_streaming {} // expected-error {{'__arm_streaming' is not supported on this target}}

0 commit comments

Comments
 (0)