[clang] [clang][TableGen] Change HTML Tags emitter to use const RecordKeeper (PR #108202)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 07:39:53 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/108202.diff
2 Files Affected:
- (modified) clang/utils/TableGen/ClangCommentHTMLTagsEmitter.cpp (+7-6)
- (modified) clang/utils/TableGen/TableGenBackends.h (+2-2)
``````````diff
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 3a424c9c91fe71..a3e01952f99289 100644
--- a/clang/utils/TableGen/TableGenBackends.h
+++ b/clang/utils/TableGen/TableGenBackends.h
@@ -83,9 +83,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(llvm::RecordKeeper &Records,
llvm::raw_ostream &OS);
``````````
</details>
https://github.com/llvm/llvm-project/pull/108202
More information about the cfe-commits
mailing list