[cfe-dev] Guidance: clang or llvm
Douglas Gregor
dgregor at apple.com
Mon Dec 20 22:01:06 PST 2010
On Dec 18, 2010, at 10:21 PM, Munawar Hafiz wrote:
> Hi,
> I am implementing refactorings in CDT using clang (or llvm?) as the analysis engine. I am planning to write these library functions on top of clang, and then using native calls to communicate with them. Here are some specific things that I want to perform.
>
> a) Given two variables, ask analysis engine if they are aliases or not.
> b) Given a variable, find about its points-to-set.
If you want pointer analysis, you'll probably need LLVM's analysis. Mapping that information back to Clang's ASTs will be nontrivial, though.
> c) Given a variable, follow its def-use chain.
> d) Given a function, follow its call graph.
These could be constructed on top of Clang, although def-use information would be limited to the simple cases.
> e) Given a cursor, browse the AST. The AST may involve multiple files.
This can be done with Clang (or even libclang, the C interface). It's by far the easiest, Clang-only thing to do.
- Doug
More information about the cfe-dev
mailing list