Skip to content

Commit cafce8c

Browse files
committed
error in tablegen if an hlslattribute is added that isn't all lower case
1 parent 94f9146 commit cafce8c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: not clang-tblgen -gen-clang-attr-parsed-attr-kinds -I%p/../../include %s -o - 2>&1 | FileCheck %s
2+
3+
include "clang/Basic/Attr.td"
4+
5+
// CHECK: error: HLSLAnnotation Attribute must be lower case.
6+
def HLSLSV_FAKE: HLSLAnnotationAttr {
7+
let Spellings = [HLSLAnnotation<"SV_Fake">];
8+
let Subjects = SubjectList<[ParmVar, Field]>;
9+
let LangOpts = [HLSL];
10+
let Documentation = [HLSLSV_GroupThreadIDDocs];
11+
}

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4932,6 +4932,9 @@ void EmitClangAttrParsedAttrKinds(const RecordKeeper &Records,
49324932
Matches = &Pragma;
49334933
} else if (Variety == "HLSLAnnotation") {
49344934
Matches = &HLSLAnnotation;
4935+
if (RawSpelling.compare(RawSpelling.lower()) != 0)
4936+
PrintError(S.getSpellingRecord().getLoc(),
4937+
"HLSLAnnotation Attribute must be lower case.");
49354938
}
49364939

49374940
assert(Matches && "Unsupported spelling variety found");

0 commit comments

Comments
 (0)