madsravn created this revision. madsravn added reviewers: aaron.ballman, malcolm.parsons. madsravn added a subscriber: cfe-commits.
The tutorial contains a few errors which results in code not being able to compile. One error was described here: https://llvm.org/bugs/show_bug.cgi?id=25583 . I found and fixed the error and one additional error. https://reviews.llvm.org/D28180 Files: docs/LibASTMatchersTutorial.rst Index: docs/LibASTMatchersTutorial.rst =================================================================== --- docs/LibASTMatchersTutorial.rst +++ docs/LibASTMatchersTutorial.rst @@ -496,9 +496,9 @@ void LoopPrinter::run(const MatchFinder::MatchResult &Result) { ASTContext *Context = Result.Context; - const ForStmt *FS = Result.Nodes.getStmtAs<ForStmt>("forLoop"); + const ForStmt *FS = Result.Nodes.getNodeAs<ForStmt>("forLoop"); // We do not want to convert header files! - if (!FS || !Context->getSourceManager().isFromMainFile(FS->getForLoc())) + if (!FS || !Context->getSourceManager().isWrittenInMainFile(FS->getForLoc())) return; const VarDecl *IncVar = Result.Nodes.getNodeAs<VarDecl>("incVarName"); const VarDecl *CondVar = Result.Nodes.getNodeAs<VarDecl>("condVarName");
Index: docs/LibASTMatchersTutorial.rst =================================================================== --- docs/LibASTMatchersTutorial.rst +++ docs/LibASTMatchersTutorial.rst @@ -496,9 +496,9 @@ void LoopPrinter::run(const MatchFinder::MatchResult &Result) { ASTContext *Context = Result.Context; - const ForStmt *FS = Result.Nodes.getStmtAs<ForStmt>("forLoop"); + const ForStmt *FS = Result.Nodes.getNodeAs<ForStmt>("forLoop"); // We do not want to convert header files! - if (!FS || !Context->getSourceManager().isFromMainFile(FS->getForLoc())) + if (!FS || !Context->getSourceManager().isWrittenInMainFile(FS->getForLoc())) return; const VarDecl *IncVar = Result.Nodes.getNodeAs<VarDecl>("incVarName"); const VarDecl *CondVar = Result.Nodes.getNodeAs<VarDecl>("condVarName");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits