Skip to content

Commit e382b0c

Browse files
authored
[clang][TableGen] Change HTML Tags emitter to use const RecordKeeper (#108202)
Change HTML Tags emitter to use const RecordKeeper. This is a part of effort to have better const correctness in TableGen backends: https://discourse.llvm.org/t/psa-planned-changes-to-tablegen-getallderiveddefinitions-api-potential-downstream-breakages/81089
1 parent dca9f21 commit e382b0c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919

2020
using namespace llvm;
2121

22-
void clang::EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
23-
std::vector<Record *> Tags = Records.getAllDerivedDefinitions("Tag");
22+
void clang::EmitClangCommentHTMLTags(const RecordKeeper &Records,
23+
raw_ostream &OS) {
24+
ArrayRef<const Record *> Tags = Records.getAllDerivedDefinitions("Tag");
2425
std::vector<StringMatcher::StringPair> Matches;
25-
for (Record *Tag : Tags) {
26+
for (const Record *Tag : Tags) {
2627
Matches.emplace_back(std::string(Tag->getValueAsString("Spelling")),
2728
"return true;");
2829
}
@@ -35,12 +36,12 @@ void clang::EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
3536
<< "}\n\n";
3637
}
3738

38-
void clang::EmitClangCommentHTMLTagsProperties(RecordKeeper &Records,
39+
void clang::EmitClangCommentHTMLTagsProperties(const RecordKeeper &Records,
3940
raw_ostream &OS) {
40-
std::vector<Record *> Tags = Records.getAllDerivedDefinitions("Tag");
41+
ArrayRef<const Record *> Tags = Records.getAllDerivedDefinitions("Tag");
4142
std::vector<StringMatcher::StringPair> MatchesEndTagOptional;
4243
std::vector<StringMatcher::StringPair> MatchesEndTagForbidden;
43-
for (Record *Tag : Tags) {
44+
for (const Record *Tag : Tags) {
4445
std::string Spelling = std::string(Tag->getValueAsString("Spelling"));
4546
StringMatcher::StringPair Match(Spelling, "return true;");
4647
if (Tag->getValueAsBit("EndTagOptional"))

clang/utils/TableGen/TableGenBackends.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ void EmitClangDiagsIndexName(llvm::RecordKeeper &Records,
8484

8585
void EmitClangSACheckers(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
8686

87-
void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records,
87+
void EmitClangCommentHTMLTags(const llvm::RecordKeeper &Records,
8888
llvm::raw_ostream &OS);
89-
void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records,
89+
void EmitClangCommentHTMLTagsProperties(const llvm::RecordKeeper &Records,
9090
llvm::raw_ostream &OS);
9191
void EmitClangCommentHTMLNamedCharacterReferences(
9292
const llvm::RecordKeeper &Records, llvm::raw_ostream &OS);

0 commit comments

Comments
 (0)