[clang] e382b0c - [clang][TableGen] Change HTML Tags emitter to use const RecordKeeper (#108202)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 10:50:29 PDT 2024
Author: Rahul Joshi
Date: 2024-09-11T10:50:26-07:00
New Revision: e382b0c9972b4a3cf6c4bc21be50e12b76a488bd
URL: https://github.com/llvm/llvm-project/commit/e382b0c9972b4a3cf6c4bc21be50e12b76a488bd
DIFF: https://github.com/llvm/llvm-project/commit/e382b0c9972b4a3cf6c4bc21be50e12b76a488bd.diff
LOG: [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
Added:
Modified:
clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
clang/utils/TableGen/TableGenBackends.h
Removed:
################################################################################
diff --git a/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp b/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
index 3dc1098753e0bf..a457315bc62c5c 100644
--- a/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
+++ b/clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp
@@ -19,10 +19,11 @@
using namespace llvm;
-void clang::EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
- std::vector<Record *> Tags = Records.getAllDerivedDefinitions("Tag");
+void clang::EmitClangCommentHTMLTags(const RecordKeeper &Records,
+ raw_ostream &OS) {
+ ArrayRef<const Record *> Tags = Records.getAllDerivedDefinitions("Tag");
std::vector<StringMatcher::StringPair> Matches;
- for (Record *Tag : Tags) {
+ for (const Record *Tag : Tags) {
Matches.emplace_back(std::string(Tag->getValueAsString("Spelling")),
"return true;");
}
@@ -35,12 +36,12 @@ void clang::EmitClangCommentHTMLTags(RecordKeeper &Records, raw_ostream &OS) {
<< "}\n\n";
}
-void clang::EmitClangCommentHTMLTagsProperties(RecordKeeper &Records,
+void clang::EmitClangCommentHTMLTagsProperties(const RecordKeeper &Records,
raw_ostream &OS) {
- std::vector<Record *> Tags = Records.getAllDerivedDefinitions("Tag");
+ ArrayRef<const Record *> Tags = Records.getAllDerivedDefinitions("Tag");
std::vector<StringMatcher::StringPair> MatchesEndTagOptional;
std::vector<StringMatcher::StringPair> MatchesEndTagForbidden;
- for (Record *Tag : Tags) {
+ for (const Record *Tag : Tags) {
std::string Spelling = std::string(Tag->getValueAsString("Spelling"));
StringMatcher::StringPair Match(Spelling, "return true;");
if (Tag->getValueAsBit("EndTagOptional"))
diff --git a/clang/utils/TableGen/TableGenBackends.h b/clang/utils/TableGen/TableGenBackends.h
index e8287d5bee08b3..503684118278bf 100644
--- a/clang/utils/TableGen/TableGenBackends.h
+++ b/clang/utils/TableGen/TableGenBackends.h
@@ -84,9 +84,9 @@ void EmitClangDiagsIndexName(llvm::RecordKeeper &Records,
void EmitClangSACheckers(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
-void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records,
+void EmitClangCommentHTMLTags(const llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
-void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records,
+void EmitClangCommentHTMLTagsProperties(const llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
void EmitClangCommentHTMLNamedCharacterReferences(
const llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
More information about the cfe-commits
mailing list