[cfe-dev] LibTooling CMake Error
Mohammad Adil
madil90 at gmail.com
Fri Oct 19 07:04:07 PDT 2012
Thnx a lot. I didn't realize that I had to put my code in the extra
tools repository. But with your CMakeLists , it's working independently. I
have a few small issues though.
I need to pass in a cpp file rather than the code in the command line.
How do I do that? I have tried modifying the parameters of runtooloncode
but they are not working. (I need to rewrite in that file)
I need to find all the instances of a variable usage in a file. e.g.
Every place where 'x' was used. How can I do that?
I am very grateful for your help.
Regards,
Adil
On Fri, Oct 19, 2012 at 6:17 PM, Philip Craig <philipjcraig at gmail.com>wrote:
> On Fri, Oct 19, 2012 at 10:22 PM, Mohammad Adil <madil90 at gmail.com> wrote:
> > I've checked out the extra tools repository at the correct place and I
> have
> > built clang again, with the CLANG_BUILD_EXAMPLES variable set to true in
> > cmake. I am still getting the same error. What can possibly be wrong? Can
> > you please provide all the steps required to make this command work.
>
> Did you place your example code in the extra tools repository as well?
> There isn't any documentation for this, but it is straight forward to
> copy how the existing tools in the repository are built.
>
> > The two cmake files you mentioned are both related to libclang. I am
> > using Libtooling. How do I adapt them to build the FrontEndAction example
> > given in the docs.
>
> Tooling is part of libclang. I've pushed a version of the
> FrontEndAction example that compiles for me to
> https://github.com/philipc/find-class-decls
>
> > On Fri, Oct 19, 2012 at 4:12 PM, Philip Craig <philipjcraig at gmail.com>
> > wrote:
> >>
> >> On Fri, Oct 19, 2012 at 8:52 PM, madil90 <madil90 at gmail.com> wrote:
> >> > Hi,
> >> > I am trying to setup LibTooling for clang. I have gone through the
> >> > procedure given at </a>
> >> > <http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html> . I can
> >> > succesfully run clang-check for any source file. I am now trying to
> >> > compile
> >> > the example at </a> <
> http://clang.llvm.org/docs/RAVFrontendAction.html>
> >> > .
> >> > When using cmake, I get the following error:
> >> >
> >> > Unknown CMake command : add_clang_executable
> >> >
> >> > When using cmake to build clang, I used
> >> > -DEXPORT_CMAKE_COMPILE_COMMANDS=ON
> >> > variable as suggested. Then why isn't this command working?
> >>
> >> add_clang_executable is defined in the clang cmake files, so to use it
> >> you need to build the example as part of clang. If you want to follow
> >> this route, then a convenient place in the tree to put it is in the
> >> extra tools repository. Have a look at
> >> http://clang.llvm.org/docs/ClangTools.html
> >>
> >> Alternatively, to build standalone, you can try copying the cmake
> >> configuration from
> >> https://github.com/philipc/clang-ast/blob/master/CMakeLists.standalone
> >> and
> >>
> https://github.com/philipc/clang-ast/blob/master/cmake/modules/FindLibClang.cmake
> >
> >
> >
> >
> > --
> > Mohammad Adil
> > LUMS SSE
> >
>
--
Mohammad Adil
LUMS SSE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121019/809580f1/attachment.html>
More information about the cfe-dev
mailing list