From e8932e5b5442d1d56dfce675342cc515be238fe3 Mon Sep 17 00:00:00 2001 From: Mads Ravn Date: Fri, 30 Dec 2016 20:49:44 +0000 Subject: [PATCH] [clang] Minor fix to libASTMatcherTutorial There was a small error in the code in the tutorial. 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. Reviewers: aaron.ballman, malcolm.parsons Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290766 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LibASTMatchersTutorial.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/LibASTMatchersTutorial.rst b/docs/LibASTMatchersTutorial.rst index 603b2faf01..baf2c1c3e6 100644 --- a/docs/LibASTMatchersTutorial.rst +++ b/docs/LibASTMatchersTutorial.rst @@ -496,9 +496,9 @@ And change ``LoopPrinter::run`` to void LoopPrinter::run(const MatchFinder::MatchResult &Result) { ASTContext *Context = Result.Context; - const ForStmt *FS = Result.Nodes.getStmtAs("forLoop"); + const ForStmt *FS = Result.Nodes.getNodeAs("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("incVarName"); const VarDecl *CondVar = Result.Nodes.getNodeAs("condVarName"); -- 2.40.0