[clang-tools-extra] [clang-tidy] Update google todo checker with style guide changes. (PR #165565)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 29 09:12:05 PDT 2025
================
@@ -17,28 +17,37 @@ class TodoCommentCheck::TodoCommentHandler : public CommentHandler {
public:
TodoCommentHandler(TodoCommentCheck &Check, std::optional<std::string> User)
: Check(Check), User(User ? *User : "unknown"),
- TodoMatch("^// *TODO *(\\(.*\\))?:?( )?(.*)$") {}
+ TodoMatch("^// *TODO *((\\((.*)\\))?:?( )?|: *(.*) *- *)?(.*)$") {}
bool HandleComment(Preprocessor &PP, SourceRange Range) override {
StringRef Text =
Lexer::getSourceText(CharSourceRange::getCharRange(Range),
PP.getSourceManager(), PP.getLangOpts());
- SmallVector<StringRef, 4> Matches;
+ SmallVector<StringRef, 7> Matches;
if (!TodoMatch.match(Text, &Matches))
return false;
- StringRef Username = Matches[1];
- StringRef Comment = Matches[3];
+ const bool deprecated_style = !Matches[3].empty();
+ StringRef Username = deprecated_style ? Matches[5] : Matches[3];
+ StringRef Comment = Matches[6];
----------------
EugeneZelenko wrote:
```suggestion
const StringRef Username = deprecated_style ? Matches[5] : Matches[3];
const StringRef Comment = Matches[6];
```
https://github.com/llvm/llvm-project/pull/165565
More information about the cfe-commits
mailing list