[clang-tools-extra] [clang-tidy] Add modernize-use-std-tie check (PR #191218)
Daniil Dudkin via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 9 16:53:50 PDT 2026
================
@@ -0,0 +1,108 @@
+#include "UseStdTieCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+
+void UseStdTieCheck::registerMatchers(MatchFinder *Finder) {
+ Finder->addMatcher(functionDecl(anyOf(hasOverloadedOperatorName("<"),
+ hasOverloadedOperatorName(">")))
+ .bind("bad-operator"),
+ this);
+}
+
+void UseStdTieCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *MatchedDecl =
+ Result.Nodes.getNodeAs<FunctionDecl>("bad-operator");
+ if (!MatchedDecl || !MatchedDecl->hasBody())
+ return;
+
+ // 1. SIMPLE SCANNER: Find all 'return' statements inside the function
----------------
unterumarmung wrote:
Please do not use CAPS.
https://github.com/llvm/llvm-project/pull/191218
More information about the cfe-commits
mailing list