https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/198069
>From a735e165168dfcd74c39f0ed17af04aba641a7d3 Mon Sep 17 00:00:00 2001 From: Paul Kirth <[email protected]> Date: Sat, 16 May 2026 01:26:35 +0000 Subject: [PATCH 1/2] [clang-doc] Use explicit for single param constructors This trips up some clang-tidy checks, so add the explicit keyword as needed to satisfy the lints. --- clang-tools-extra/clang-doc/BitcodeWriter.cpp | 2 +- clang-tools-extra/clang-doc/ClangDoc.cpp | 4 ++-- clang-tools-extra/clang-doc/Serialize.cpp | 2 +- clang-tools-extra/clang-doc/YAMLGenerator.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.cpp b/clang-tools-extra/clang-doc/BitcodeWriter.cpp index cbd61b05c6e0a..f8431a44ec533 100644 --- a/clang-tools-extra/clang-doc/BitcodeWriter.cpp +++ b/clang-tools-extra/clang-doc/BitcodeWriter.cpp @@ -100,7 +100,7 @@ struct RecordIdDsc { : Name(Name), Abbrev(Abbrev) {} // Is this 'description' valid? - operator bool() const { + explicit operator bool() const { return Abbrev != nullptr && Name.data() != nullptr && !Name.empty(); } diff --git a/clang-tools-extra/clang-doc/ClangDoc.cpp b/clang-tools-extra/clang-doc/ClangDoc.cpp index ec802d64fb609..7f5204f1e4d24 100644 --- a/clang-tools-extra/clang-doc/ClangDoc.cpp +++ b/clang-tools-extra/clang-doc/ClangDoc.cpp @@ -24,7 +24,7 @@ namespace doc { class MapperActionFactory : public tooling::FrontendActionFactory { public: - MapperActionFactory(ClangDocContext CDCtx) : CDCtx(CDCtx) {} + explicit MapperActionFactory(ClangDocContext CDCtx) : CDCtx(CDCtx) {} std::unique_ptr<FrontendAction> create() override; private: @@ -34,7 +34,7 @@ class MapperActionFactory : public tooling::FrontendActionFactory { std::unique_ptr<FrontendAction> MapperActionFactory::create() { class ClangDocAction : public clang::ASTFrontendAction { public: - ClangDocAction(ClangDocContext CDCtx) : CDCtx(CDCtx) {} + explicit ClangDocAction(ClangDocContext CDCtx) : CDCtx(CDCtx) {} std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(clang::CompilerInstance &Compiler, diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp index 5ad7327076763..26ce357674f14 100644 --- a/clang-tools-extra/clang-doc/Serialize.cpp +++ b/clang-tools-extra/clang-doc/Serialize.cpp @@ -203,7 +203,7 @@ StringRef Serializer::getInfoRelativePath(const Decl *D) { class ClangDocCommentVisitor : public ConstCommentVisitor<ClangDocCommentVisitor> { public: - ClangDocCommentVisitor(CommentInfo &CI) : CurrentCI(CI) {} + explicit ClangDocCommentVisitor(CommentInfo &CI) : CurrentCI(CI) {} void parseComment(const comments::Comment *C); diff --git a/clang-tools-extra/clang-doc/YAMLGenerator.cpp b/clang-tools-extra/clang-doc/YAMLGenerator.cpp index a16d6342e684e..93ece04b74476 100644 --- a/clang-tools-extra/clang-doc/YAMLGenerator.cpp +++ b/clang-tools-extra/clang-doc/YAMLGenerator.cpp @@ -195,8 +195,8 @@ template <> struct ScalarTraits<SymbolID> { struct QuotedString { StringRef Ref; QuotedString() = default; - QuotedString(StringRef R) : Ref(R) {} - operator StringRef() const { return Ref; } + explicit QuotedString(StringRef R) : Ref(R) {} + explicit operator StringRef() const { return Ref; } bool operator==(const QuotedString &Other) const { return Ref == Other.Ref; } }; >From 56f88793535b0b78d49865689c95939840ad5e84 Mon Sep 17 00:00:00 2001 From: Paul Kirth <[email protected]> Date: Sat, 16 May 2026 01:37:45 +0000 Subject: [PATCH 2/2] [clang-doc][nfc] Declare pointer with auto explicitly This silences some errors from clang-tidy. --- clang-tools-extra/clang-doc/Serialize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp index 26ce357674f14..9ab3de5d9b49f 100644 --- a/clang-tools-extra/clang-doc/Serialize.cpp +++ b/clang-tools-extra/clang-doc/Serialize.cpp @@ -1159,7 +1159,7 @@ std::pair<Info *, Info *> Serializer::emitInfo(const RecordDecl *D, // Records are inserted into the parent by reference, so we need to return // both the parent and the record itself. - auto Parent = makeAndInsertIntoParent<const RecordInfo &>(*RI); + auto *Parent = makeAndInsertIntoParent<const RecordInfo &>(*RI); return {std::move(RI), std::move(Parent)}; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
