[PATCH] D52219: [analyzer] (1/n) Support pointee mutation analysis in ExprMutationAnalyzer.

Shuai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 17 22:53:15 PDT 2018


shuaiwang created this revision.
shuaiwang added reviewers: JonasToth, aaron.ballman.
Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, a.sidorin, szepet, xazax.hun.
Herald added a reviewer: george.karpenkov.

We handle pointee mutation for native pointers & pointer-like types
(loosely defined as having an `operator*` returning non-const reference)

This diff alone just implemented the cases where pointee of an `Exp` is
*directly* mutated (e.g. invoking non-const member function.)

The most trivial class of casts is handled as well for easier unit
testing, `findPointeeCastMutation` is not done yet.

Planned future work:

- `findPointeeDerefMutation`: `Exp` is first dereferenced, and then mutated.
- `findPointee{Member,Array}Mutation`: member (or array element) of pointee is accessed and then mutated.
- `findPointeeArithmeticMutation`: handling pointer arithmetic
- `findPointeeAssignmentMutation`: pointer is assigned to another var and then mutated.


Repository:
  rC Clang

https://reviews.llvm.org/D52219

Files:
  include/clang/Analysis/Analyses/ExprMutationAnalyzer.h
  lib/Analysis/ExprMutationAnalyzer.cpp
  unittests/Analysis/ExprMutationAnalyzerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52219.165896.patch
Type: text/x-patch
Size: 22189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180918/b3c7acdd/attachment-0001.bin>


More information about the cfe-commits mailing list