Skip to content

Commit 661c950

Browse files
author
Erich Keane
committed
[NFC][Attr TableGen] Emit Spelling Enum for Attr types if there >1
Discovered in a downstream, it is often useful to have slightly different semantics for an attribute based on its namespace, however our spelling infrastructure doesn't consider namespace when deciding to elide the enum list. The result is that the solution for a case where an attribute has slightly different semantics based on a namespace requires checking against the integer value, which is fragile. This patch makes us always emit the spelling enum if there is more than 1 and we're generating the header. Differential Revision: https://reviews.llvm.org/D76289
1 parent be9e3d9 commit 661c950

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
23292329
SemanticSpellingMap SemanticToSyntacticMap;
23302330

23312331
std::string SpellingEnum;
2332-
if (!ElideSpelling)
2332+
if (Spellings.size() > 1)
23332333
SpellingEnum = CreateSemanticSpellings(Spellings, SemanticToSyntacticMap);
23342334
if (Header)
23352335
OS << SpellingEnum;

0 commit comments

Comments
 (0)