[cfe-dev] Problems with tutorial

David Blaikie dblaikie at gmail.com
Sun Apr 14 22:53:47 PDT 2013


On Fri, Apr 12, 2013 at 4:18 AM, Pedro Delgado Perez
<pedro.delgadoperez at mail.uca.es> wrote:
> Hello everyone,
>
> To get started with Clang, I'm trying to reproduce the examles in tutorial.
> I began with:
>
> http://clang.llvm.org/docs/LibASTMatchersTutorial.html
>
> I accomplished Step 0 and 1 without any problems, but I had trouble with
> Step 2.
> 1. The directory ~/clang-llvm/llvm/llvm_build doesn't exist. So, I tried to
> rerun ninja in ~/clang-llvm/build as I did in Step 1, but it says: "ninja:
> no work to do"
> How can I recompile LoopConvert?

I assume "llvm_build" is a mistype and it should be
~/clang-llvm/build. Are you sure you followed the steps in (1) to
change the CMakeLists.txt file, for example?

If you're not sure how to /rebuild/ - that should happen
automatically, if you make any changes. If it's not rebuilding, try
editing the source files and running the ninja command again.

> 2. If I run now bin/loop-convert test.cpp as in Step1, it says:
> LLVM ERROR: Could not auto-detect compilation database for file "test.cpp"
> No compilation database found in /home/pedro/clang-llvm/build or any parent
> directory
> json-compilation-database: Error while opening JSON database: No such file
> or directory
>
> What's the problem now? What have changed?

http://clang.llvm.org/docs/JSONCompilationDatabase.html might provide some help.

> After this, I tried to follow this other tutorial:
> ttp://clang.llvm.org/docs/RAVFrontendAction.html
>
> As in Step1, I put FindClassDecls.cpp in a directory called find-class-decls
> in ~/clang-llvm/llvm/tools/clang/tools andc hanged the CMakeLists.txt in
> tools. Then, I run ninja in ~/clang-llvm/build and I get the next error:
>
> /home/pedro/clang-llvm/llvm/tools/clang/tools/find-class-decls/FindClassDecls.cpp:17:43:
> error: member access into incomplete type 'clang::ASTContext'

Looks like it needs "ASTContext.h" included.

>       FullSourceLoc FullLocation =
> Context->getFullLoc(Declaration->getLocStart());
>                                           ^
> /home/pedro/clang-llvm/llvm/tools/clang/include/clang/AST/ASTConsumer.h:18:9:
> note: forward declaration of 'clang::ASTContext'
>   class ASTContext;
>         ^
> /home/pedro/clang-llvm/llvm/tools/clang/tools/find-class-decls/FindClassDecls.cpp:36:33:
> error: member access into incomplete type 'clang::ASTContext'
>     Visitor.TraverseDecl(Context.getTranslationUnitDecl());
>                                 ^
> /home/pedro/clang-llvm/llvm/tools/clang/include/clang/AST/ASTConsumer.h:18:9:
> note: forward declaration of 'clang::ASTContext'
>   class ASTContext;
>         ^
> 2 errors generated.
>
>
>
> What's happening here?
>
>
> Thanks in advance.
>
> Pedro.
>
> PD; By the way, LoopPrinter class in
> http://clang.llvm.org/docs/LibASTMatchersTutorial.html lacks a '}' before
> '};'
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list