[PATCH] D64991: [analyzer][WIP] Implement a primitive reaching definitions analysis

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 16:23:18 PDT 2019


Szelethus updated this revision to Diff 222514.
Szelethus added a comment.

I'm starting to be really happy with the current direction! I think I'll start splitting this up soon, I'm confident that the current interface (after some polishing) is general enough to develop incrementally.

- Introduce `Variable`, a base class of `Definition`, which is a (`VarDecl`, `FieldChain`) pair.
- Introduce `GenSetBuilder`, a class that owns all `MatchFinder`s and associated callbacks used for finding potential writes and invalidations to `Variable`s, use exclusively it to build GEN sets.
  - Use a very flexible interface for creating and registering matchers for either
    - Creating the set of `Variable`s accessible to a function
    - Finding statements that may write any of those
    - Teasing an `Expr` apart to find `Variable`s in it
  - In an `init()` pass, collect all variables used, or potentially invalidated in the function. This allows for invalidations and writes to be done in a single pass on a `CFGStmt`.
  - Added a very primitive solution to invalidate variables passed to functions as a non-const reference.


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

https://reviews.llvm.org/D64991

Files:
  clang/include/clang/Analysis/Analyses/ReachingDefinitions.h
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/Analysis/CMakeLists.txt
  clang/lib/Analysis/ReachingDefinitions.cpp
  clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
  clang/test/Analysis/dump-definitions.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64991.222514.patch
Type: text/x-patch
Size: 60186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190930/27371da7/attachment-0001.bin>


More information about the cfe-commits mailing list