[PATCH] D45679: [clang-tidy] Add ExprMutationAnalyzer, that analyzes whether an expression is mutated within a statement.

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 10 10:58:36 PDT 2018


shuaiwang added a comment.

I have a rough idea about how `findPointeeMutation` would look like, I'm pretty sure I can use a lot of your help :)
My current plan:

- Finish the few existing pending changes
- Move the analyzer to `clang/lib/Analysis` (likely remove `PseudoConstantAnalysis` there as well since it appears to be dead code for years)
- Implement `findPointeeMutation`

In https://reviews.llvm.org/D45679#1229071, @JonasToth wrote:

> @shuaiwang What are you working on next? Do you have an idea on how we
>  will handle the pointee of a pointer? That would be very interesting for
>  my const-correctness check. if you need help with anything, just say so.
>  I would like to support
>
> Am 10.09.2018 um 18:49 schrieb Shuai Wang via Phabricator:
>
> > shuaiwang added a comment.
> > 
> > In https://reviews.llvm.org/D45679#1183116, @george.karpenkov wrote:
> > 
> >> @aaron.ballman @alexfh @shuaiwang Would it be possible to move that code into a matcher, or into a something which could be used from Clang? We would also like to use similar functionality, but can't include stuff from clang-tidy.
> > 
> > FYI I haven't forgot about this, I'll look into doing it after a few pending changes are in.
> > 
> > ================
> >  Comment at: clang-tidy/utils/ExprMutationAnalyzer.h:38
> >  +  const Stmt *findDeclMutation(ArrayRef<ast_matchers::BoundNodes> Matches);
> >  +  const Stmt *findDeclMutation(const Decl *Dec);
> >  +
> > 
> >  ----------------
> > 
> > lebedev.ri wrote:
> > 
> >> lebedev.ri wrote:
> >> 
> >>> lebedev.ri wrote:
> >>> 
> >>>> @shuaiwang, @JonasToth hi.
> >>>>  Is it very intentional that this `findDeclMutation()` is private?
> >>>> 
> >>>> Is there some other way i should be doing if i have a statement `S`,
> >>>>  a declRefExpr `D`, and i want to find the statement `Q`, which mutates
> >>>>  the underlying variable to which the declRefExpr `D` refers?
> >>> 
> >>> (the statement `Q` within the statement `S`, of course)
> >> 
> >> @shuaiwang after a disscussion about this in IRC with @JonasToth, i have filed https://bugs.llvm.org/show_bug.cgi?id=38888
> >>  But i'm failing to CC you there. Are you not registered in the bugzilla?
> > 
> > There's no real reason findDeclMutation is private other than that there wasn't a use case :)
> >  Feel free to make it public if you find it useful that way.
> > 
> > I'll take a look at the bug, thanks for reporting it!
> >  (I don't have an account there yet, I'm requesting one right now, will follow up in the bug)
> > 
> > Repository:
> > 
> >   rCTE Clang Tools Extra
> > 
> > https://reviews.llvm.org/D45679





Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45679





More information about the cfe-commits mailing list