[cfe-dev] How do I retrieve all non-local variables a function has access to?

Kristóf Umann via cfe-dev cfe-dev at lists.llvm.org
Sun Jul 21 13:10:11 PDT 2019

On Sun, 21 Jul 2019 at 20:58, Miklos Vajna <vmiklos at vmiklos.hu> wrote:

> Hi Kristóf,
> On Sun, Jul 21, 2019 at 12:42:34PM +0200, Kristóf Umann via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> > I'm trying to implement a primitive reaching definitions algorithm for
> C++,
> > but am struggling a bit.
> Is this about finding unused data members and functions where the
> compiler can't detect them as that requires CTU analysis?

No, not really, I'm trying to find reaching definitions to variables (for
example when they caused a division by zero error) to teach the analyzer
that certain parts of the program are important, and make it emit bug
reports that explain control flow around them better.

> If so, you might want to look at
> <
> https://cgit.freedesktop.org/libreoffice/core/tree/compilerplugins/clang/unusedmethods.cxx
> >,
> and other unused* files in the same directory, which use the clang AST
> to find unused code; though they don't use AST matchers.

I took a look and I think this isn't what I'm looking for specifically, but
thanks for the suggestion! :)

> Regards,
> Miklos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190721/a4999b06/attachment.html>

More information about the cfe-dev mailing list