MathHeader(Options.get("MathHeader", "math.h")) {}
void InitVariablesCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(varDecl(unless(hasInitializer(anything())),
- unless(isInstantiated()), isLocalVarDecl(),
- unless(isStaticLocal()), isDefinition())
- .bind("vardecl"),
- this);
+ std::string BadDecl = "badDecl";
+ Finder->addMatcher(
+ varDecl(unless(hasInitializer(anything())), unless(isInstantiated()),
+ isLocalVarDecl(), unless(isStaticLocal()), isDefinition(),
+ optionally(hasParent(declStmt(hasParent(
+ cxxForRangeStmt(hasLoopVariable(varDecl().bind(BadDecl))))))),
+ unless(equalsBoundNode(BadDecl)))
+ .bind("vardecl"),
+ this);
}
void InitVariablesCheck::registerPPCallbacks(const SourceManager &SM,