https://llvm.org/bugs/show_bug.cgi?id=25583
Bug ID: 25583 Summary: Outdated code example in "Tutorial for building tools using LibTooling and LibASTMatchers" does not compile Product: clang Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Documentation Assignee: unassignedclangb...@nondot.org Reporter: 24h...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified The tutorial at http://clang.llvm.org/docs/LibASTMatchersTutorial.html has the following code snippet: void LoopPrinter::run(const MatchFinder::MatchResult &Result) { ASTContext *Context = Result.Context; const ForStmt *FS = Result.Nodes.getStmtAs<ForStmt>("forLoop"); // We do not want to convert header files! if (!FS || !Context->getSourceManager().isFromMainFile(FS->getForLoc())) return; const VarDecl *IncVar = Result.Nodes.getNodeAs<VarDecl>("incVarName"); const VarDecl *CondVar = Result.Nodes.getNodeAs<VarDecl>("condVarName"); const VarDecl *InitVar = Result.Nodes.getNodeAs<VarDecl>("initVarName"); if (!areSameVariable(IncVar, CondVar) || !areSameVariable(IncVar, InitVar)) return; llvm::outs() << "Potential array-based loop discovered.\n"; } This does not compile. The function call to isFromMainFile needs to be changed to isWrittenInMainFile. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs