[clang-tools-extra] [clang-tidy][readability-identifier-length] Add a line count threshold (PR #185319)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 01:45:51 PDT 2026


================
@@ -85,6 +90,28 @@ void IdentifierLengthCheck::registerMatchers(MatchFinder *Finder) {
         this);
 }
 
+static unsigned countLinesToLastUse(const VarDecl *Var,
+                                    const SourceManager *SrcMgr,
+                                    ASTContext *Ctx) {
+  const auto *ParentScope = llvm::dyn_cast<FunctionDecl>(Var->getDeclContext());
+  if (ParentScope == nullptr) {
+    return 1;
+  }
----------------
vbvictor wrote:

I agree we should omit warning on globals. Can we add docs for it and tests.

https://github.com/llvm/llvm-project/pull/185319


More information about the cfe-commits mailing list