Skip to content

Commit d99b148

Browse files
authored
[TableGen] Fix __CLAUSE_NO_CLASS macro leak in directive emitter (llvm#82912)
`__CLAUSE_NO_CLASS` was not undefined inside the `GEN_CLANG_CLAUSE_CLASS` block, resulting in macro redifinition warnings when several generated directives are used simultaneously.
1 parent cb4f94d commit d99b148

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

llvm/test/TableGen/directive1.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def TDL_DirA : Directive<"dira"> {
258258
// IMPL-EMPTY:
259259
// IMPL-NEXT: #undef __IMPLICIT_CLAUSE_NO_CLASS
260260
// IMPL-NEXT: #undef __IMPLICIT_CLAUSE_CLASS
261+
// IMPL-NEXT: #undef __CLAUSE_NO_CLASS
261262
// IMPL-NEXT: #undef __CLAUSE
262263
// IMPL-NEXT: #undef CLAUSE_NO_CLASS
263264
// IMPL-NEXT: #undef CLAUSE_CLASS

llvm/test/TableGen/directive2.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def TDL_DirA : Directive<"dira"> {
206206
// IMPL-EMPTY:
207207
// IMPL-NEXT: #undef __IMPLICIT_CLAUSE_NO_CLASS
208208
// IMPL-NEXT: #undef __IMPLICIT_CLAUSE_CLASS
209+
// IMPL-NEXT: #undef __CLAUSE_NO_CLASS
209210
// IMPL-NEXT: #undef __CLAUSE
210211
// IMPL-NEXT: #undef CLAUSE_NO_CLASS
211212
// IMPL-NEXT: #undef CLAUSE_CLASS

llvm/utils/TableGen/DirectiveEmitter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ static void GenerateClauseClassMacro(const DirectiveLanguage &DirLang,
842842
OS << "\n";
843843
OS << "#undef __IMPLICIT_CLAUSE_NO_CLASS\n";
844844
OS << "#undef __IMPLICIT_CLAUSE_CLASS\n";
845+
OS << "#undef __CLAUSE_NO_CLASS\n";
845846
OS << "#undef __CLAUSE\n";
846847
OS << "#undef CLAUSE_NO_CLASS\n";
847848
OS << "#undef CLAUSE_CLASS\n";

0 commit comments

Comments
 (0)