Is Clang what I need?

Thank you very much David.

Which interface would you recommend me to use for my purpose? I don’t understand really well what are the difference among them (LibClang, Plugins, LibTooling or Clang Tools) and i would need to know the best option for me. What I want is to create a tool reusing Clang only to analyze C++ programs. If you need more information to give me an answer, please tell me what you would need to know.

Thanks,

Pedro D.

El dia 07 ene 2013 17:29, David Blaikie dblaikie@gmail.com escribió:

Thank you very much David.

Which interface would you recommend me to use for my purpose? I don't
understand really well what are the difference among them (LibClang,
Plugins, LibTooling or Clang Tools) and i would need to know the best option
for me. What I want is to create a tool reusing Clang only to analyze C++
programs. If you need more information to give me an answer, please tell me
what you would need to know.

If you're trying to do AST-matched source code transformations what
you probably want is to use libTooling (to write a "Clang Tool") along
with the AST matchers.

[The one thing still pending that blocks truly streamlined refactoring
tools using this infrastructure is the ability to automatically format
the modified code so it's still legible (eg: re-wrapping lines when
changing an identifier makes it shorter/longer), there's currently
work underway (in the form of "clang-format") to support this. Once
this functionality is combined with tooling and AST matchers we should
have the ability to write fairly ad-hoc C++ refactoring tools that
Just Work]

[+Manuel to this thread in case he has anything to add]

- David

> Thank you very much David.
>
> Which interface would you recommend me to use for my purpose? I don't
> understand really well what are the difference among them (LibClang,
> Plugins, LibTooling or Clang Tools) and i would need to know the best
option
> for me. What I want is to create a tool reusing Clang only to analyze C++
> programs. If you need more information to give me an answer, please tell
me
> what you would need to know.

If you're trying to do AST-matched source code transformations what
you probably want is to use libTooling (to write a "Clang Tool") along
with the AST matchers.

[The one thing still pending that blocks truly streamlined refactoring
tools using this infrastructure is the ability to automatically format
the modified code so it's still legible (eg: re-wrapping lines when
changing an identifier makes it shorter/longer), there's currently
work underway (in the form of "clang-format") to support this. Once
this functionality is combined with tooling and AST matchers we should
have the ability to write fairly ad-hoc C++ refactoring tools that
Just Work]

[+Manuel to this thread in case he has anything to add]

Yep - you can already run clang-format over the diffs afterwards (daniel
has a script that he plans to land soon).

Cheers,
/Manuel