[cfe-dev] Problems with tutorial

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Fri Apr 12 04:18:59 PDT 2013

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 [ 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?

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?

After this, I tried to follow this other tutorial:

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'
>      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.


PD; By the way, LoopPrinter class in http://clang.llvm.org/docs/LibASTMatchersTutorial.html [ http://clang.llvm.org/docs/LibASTMatchersTutorial.html ] lacks a '}' before '};'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130412/82196e47/attachment.html>

More information about the cfe-dev mailing list