File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -29,11 +29,15 @@ InitVariablesCheck::InitVariablesCheck(StringRef Name,
2929 MathHeader(Options.get(" MathHeader" , " math.h" )) {}
3030
3131void InitVariablesCheck::registerMatchers (MatchFinder *Finder) {
32- Finder->addMatcher (varDecl (unless (hasInitializer (anything ())),
33- unless (isInstantiated ()), isLocalVarDecl (),
34- unless (isStaticLocal ()), isDefinition ())
35- .bind (" vardecl" ),
36- this );
32+ std::string BadDecl = " badDecl" ;
33+ Finder->addMatcher (
34+ varDecl (unless (hasInitializer (anything ())), unless (isInstantiated ()),
35+ isLocalVarDecl (), unless (isStaticLocal ()), isDefinition (),
36+ optionally (hasParent (declStmt (hasParent (
37+ cxxForRangeStmt (hasLoopVariable (varDecl ().bind (BadDecl))))))),
38+ unless (equalsBoundNode (BadDecl)))
39+ .bind (" vardecl" ),
40+ this );
3741}
3842
3943void InitVariablesCheck::registerPPCallbacks (const SourceManager &SM,
Original file line number Diff line number Diff line change @@ -78,3 +78,9 @@ void init_unit_tests() {
7878 int parens (42 );
7979 int braces{42 };
8080}
81+
82+ template <typename RANGE>
83+ void f (RANGE r) {
84+ for (char c : r) {
85+ }
86+ }
You can’t perform that action at this time.
0 commit comments