Skip to content
Snippets Groups Projects
Commit 141f1d24 authored by Manuel Klimek's avatar Manuel Klimek
Browse files

This corrects problems in the LibASTMatchers tutorial.

Patch by Jochen Eisinger.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179683 91177308-0d34-0410-b5e6-96231b3b80d8
parent ed23bdf6
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,8 @@ guide <http://llvm.org/docs/GettingStarted.html>`_. ...@@ -27,6 +27,8 @@ guide <http://llvm.org/docs/GettingStarted.html>`_.
git clone http://llvm.org/git/llvm.git git clone http://llvm.org/git/llvm.git
cd llvm/tools cd llvm/tools
git clone http://llvm.org/git/clang.git git clone http://llvm.org/git/clang.git
cd clang/tools
git clone http://llvm.org/git/clang-tools-extra.git extra
Next you need to obtain the CMake build system and Ninja build tool. You Next you need to obtain the CMake build system and Ninja build tool. You
may already have CMake installed, but current binary versions of CMake may already have CMake installed, but current binary versions of CMake
...@@ -163,7 +165,7 @@ You should now be able to run the syntax checker, which is located in ...@@ -163,7 +165,7 @@ You should now be able to run the syntax checker, which is located in
.. code-block:: console .. code-block:: console
cat "void main() {}" > test.cpp cat "int main() { return 0; }" > test.cpp
bin/loop-convert test.cpp -- bin/loop-convert test.cpp --
Note the two dashes after we specify the source file. The additional Note the two dashes after we specify the source file. The additional
...@@ -275,8 +277,9 @@ Add the following to ``LoopConvert.cpp``: ...@@ -275,8 +277,9 @@ Add the following to ``LoopConvert.cpp``:
class LoopPrinter : public MatchFinder::MatchCallback { class LoopPrinter : public MatchFinder::MatchCallback {
public : public :
virtual void run(const MatchFinder::MatchResult &Result) { virtual void run(const MatchFinder::MatchResult &Result) {
if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop")) if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop"))
FS->dump(); FS->dump();
}
}; };
And change ``main()`` to: And change ``main()`` to:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment