[PATCH] D116518: [ast-matchers] Add hasSubstatementSequence matcher

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 07:14:33 PST 2022


ymandel added a comment.

Sorry for the delay. Read through the whole thread today. I agree with Aaron -- we shouldn't add this until

1. we have a general interface
2. we're sure this serves a general audience

As I mentioned in my previous reply, I have a working general interface that I shared and whose implementation I'd be happy to upstream. But, that brings us to point 2, for which I'm on the fence. I think it serves a general audience but I also suspect its really just a frustrating "not quite good enough" solution.

To the point of opening up matchers to a wider audience and the cost of `ASTMatchers.h` -- this sounds like a broader issue that we should find a way to address, well beyond this patch. Happy to be in on that discussion, but I don't think I have the cycles now to drive it. :)

Regarding CFG matchers -- none that I know of.  We've had it as project on our "interesting clang projects" list (in our heads) for a while, but have yet to invest in it.  What we *have* started is a dataflow analysis framework: clang/Analysis/FlowSensitive (see the unittests for some example uses). My main use of `hasSubstatementSequence` was to find pointer variables which could be safely converted to `unique_ptr`.  I converted that into a dataflow analysis built on the new framework and it's a lot cleaner.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116518/new/

https://reviews.llvm.org/D116518



More information about the cfe-commits mailing list