[clang-tools-extra] [clang-tidy] Update google todo checker with style guide changes. (PR #165565)
Quentin Khan via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 3 07:47:58 PST 2025
================
@@ -11,41 +11,100 @@
#include "clang/Lex/Preprocessor.h"
#include <optional>
-namespace clang::tidy::google::readability {
+namespace clang::tidy {
+
+namespace google::readability {
+
+enum class StyleKind { Parentheses, Hyphen };
+
+} // namespace google::readability
+
+template <> struct OptionEnumMapping<google::readability::StyleKind> {
+ static ArrayRef<std::pair<google::readability::StyleKind, StringRef>>
+ getEnumMapping() {
+ static constexpr std::pair<google::readability::StyleKind, StringRef>
+ Mapping[] = {
+ {google::readability::StyleKind::Hyphen, "Hyphen"},
+ {google::readability::StyleKind::Parentheses, "Parentheses"},
+ };
+ return {Mapping};
+ }
+};
+
+} // namespace clang::tidy
+namespace clang::tidy::google::readability {
class TodoCommentCheck::TodoCommentHandler : public CommentHandler {
public:
TodoCommentHandler(TodoCommentCheck &Check, std::optional<std::string> User)
: Check(Check), User(User ? *User : "unknown"),
- TodoMatch("^// *TODO *(\\(.*\\))?:?( )?(.*)$") {}
+ TodoMatch(R"(^// *TODO *((\((.*)\))?:?( )?|: *(.*) *- *)?(.*)$)") {
+ llvm::StringRef TodoStyleString = Check.Options.get("Style", "Hyphen");
----------------
qukhan wrote:
Done.
https://github.com/llvm/llvm-project/pull/165565
More information about the cfe-commits
mailing list