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,
29
29
MathHeader(Options.get(" MathHeader" , " math.h" )) {}
30
30
31
31
void 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 );
37
41
}
38
42
39
43
void InitVariablesCheck::registerPPCallbacks (const SourceManager &SM,
Original file line number Diff line number Diff line change @@ -78,3 +78,9 @@ void init_unit_tests() {
78
78
int parens (42 );
79
79
int braces{42 };
80
80
}
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