https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/108201
None >From 2e0b2207c6cff650edee1db9da00ef6734366cd2 Mon Sep 17 00:00:00 2001 From: Rahul Joshi <rjo...@nvidia.com> Date: Wed, 11 Sep 2024 05:05:26 -0700 Subject: [PATCH] [clang][TableGen] Change HTML Emitter to use const RecordKeeper --- ...CommentHTMLNamedCharacterReferenceEmitter.cpp | 16 ++++++---------- clang/utils/TableGen/TableGenBackends.h | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp b/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp index f1cd9af0519d1b..bd75b3f6b652a1 100644 --- a/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp +++ b/clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp @@ -46,21 +46,17 @@ static bool translateCodePointToUTF8(unsigned CodePoint, return true; } -void clang::EmitClangCommentHTMLNamedCharacterReferences(RecordKeeper &Records, - raw_ostream &OS) { - std::vector<Record *> Tags = Records.getAllDerivedDefinitions("NCR"); +void clang::EmitClangCommentHTMLNamedCharacterReferences( + const RecordKeeper &Records, raw_ostream &OS) { std::vector<StringMatcher::StringPair> NameToUTF8; SmallString<32> CLiteral; - for (std::vector<Record *>::iterator I = Tags.begin(), E = Tags.end(); - I != E; ++I) { - Record &Tag = **I; - std::string Spelling = std::string(Tag.getValueAsString("Spelling")); - uint64_t CodePoint = Tag.getValueAsInt("CodePoint"); + for (const Record *Tag : Records.getAllDerivedDefinitions("NCR")) { + std::string Spelling = std::string(Tag->getValueAsString("Spelling")); + uint64_t CodePoint = Tag->getValueAsInt("CodePoint"); CLiteral.clear(); CLiteral.append("return "); if (!translateCodePointToUTF8(CodePoint, CLiteral)) { - SrcMgr.PrintMessage(Tag.getLoc().front(), - SourceMgr::DK_Error, + SrcMgr.PrintMessage(Tag->getLoc().front(), SourceMgr::DK_Error, Twine("invalid code point")); continue; } diff --git a/clang/utils/TableGen/TableGenBackends.h b/clang/utils/TableGen/TableGenBackends.h index 3a424c9c91fe71..5dc9fbd3586ec7 100644 --- a/clang/utils/TableGen/TableGenBackends.h +++ b/clang/utils/TableGen/TableGenBackends.h @@ -87,8 +87,8 @@ void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records, llvm::raw_ostream &OS); void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records, llvm::raw_ostream &OS); -void EmitClangCommentHTMLNamedCharacterReferences(llvm::RecordKeeper &Records, - llvm::raw_ostream &OS); +void EmitClangCommentHTMLNamedCharacterReferences( + const llvm::RecordKeeper &Records, llvm::raw_ostream &OS); void EmitClangCommentCommandInfo(llvm::RecordKeeper &Records, llvm::raw_ostream &OS); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits