Index: docs/LibASTMatchersTutorial.rst =================================================================== --- docs/LibASTMatchersTutorial.rst +++ docs/LibASTMatchersTutorial.rst @@ -40,7 +40,7 @@ git clone https://github.com/martine/ninja.git cd ninja git checkout release - ./bootstrap.py + ./configure.py —bootstrap sudo cp ninja /usr/bin/ cd ~/clang-llvm @@ -59,9 +59,9 @@ mkdir build && cd build cmake -G Ninja ../llvm -DLLVM_BUILD_TESTS=ON # Enable tests; default is off. ninja - ninja check # Test LLVM only. - ninja clang-test # Test Clang only. - ninja install + ninja check-llvm # Test LLVM only. + ninja check-clang # Test Clang only. + sudo ninja install And we're live. @@ -176,6 +176,8 @@ them from a compilation database - there just aren't any options needed right now. +As there are no syntax errors in the example no output will be produced. + Intermezzo: Learn AST matcher basics ==================================== @@ -404,10 +406,10 @@ hasLHS(declRefExpr(to(varDecl(hasType(isInteger()))))), hasRHS(expr(hasType(isInteger()))))) -Why? Because it doesn't work. Of the three loops provided in +However this doesn't work, of the three loops provided in ``test-files/simple.cpp``, zero of them have a matching condition. A quick look at the AST dump of the first for loop, produced by the -previous iteration of loop-convert, shows us the answer: +previous iteration of loop-convert, shows us why: :: @@ -498,7 +500,7 @@ ASTContext *Context = Result.Context; const ForStmt *FS = Result.Nodes.getStmtAs("forLoop"); // We do not want to convert header files! - if (!FS || !Context->getSourceManager().isFromMainFile(FS->getForLoc())) + if (!FS || !Context->getSourceManager().isInMainFile(FS->getForLoc())) return; const VarDecl *IncVar = Result.Nodes.getNodeAs("incVarName"); const VarDecl *CondVar = Result.Nodes.getNodeAs("condVarName");