[PATCH] Correct LibASTMatchers tutorial

Jochen Eisinger eisinger at google.com
Wed Apr 17 07:56:39 PDT 2013


Hi klimek,

This corrects problems I ran into when trying the LibASTMatchers tutorial

http://llvm-reviews.chandlerc.com/D684

Files:
  docs/LibASTMatchersTutorial.rst

Index: docs/LibASTMatchersTutorial.rst
===================================================================
--- docs/LibASTMatchersTutorial.rst
+++ docs/LibASTMatchersTutorial.rst
@@ -27,6 +27,8 @@
       git clone http://llvm.org/git/llvm.git
       cd llvm/tools
       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
 may already have CMake installed, but current binary versions of CMake
@@ -163,7 +165,7 @@
 
 .. code-block:: console
 
-      cat "void main() {}" > test.cpp
+      cat "int main() { return 0; }" > test.cpp
       bin/loop-convert test.cpp --
 
 Note the two dashes after we specify the source file. The additional
@@ -275,8 +277,9 @@
       class LoopPrinter : public MatchFinder::MatchCallback {
       public :
         virtual void run(const MatchFinder::MatchResult &Result) {
-        if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop"))
-          FS->dump();
+          if (const ForStmt *FS = Result.Nodes.getNodeAs<clang::ForStmt>("forLoop"))
+            FS->dump();
+        }
       };
 
 And change ``main()`` to:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D684.1.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130417/669b671f/attachment.bin>


More information about the cfe-commits mailing list