================
@@ -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;
+ }
----------------
dutkalex wrote:
It is also my understanding also that this check targets local and global
variables. However, global variables can be used across multiple files and in
this context, I don't know if it makes sense to try to determine a line of last
use. I would argue that this feature should only apply to local variables, and
that the check should always warn on globals. What do you think?
https://github.com/llvm/llvm-project/pull/185319
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits