[PATCH] D64991: [analyzer][WIP] Implement a primitive reaching definitions analysis
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 13:19:10 PDT 2019
NoQ added a comment.
In D64991#1595853 <https://reviews.llvm.org/D64991#1595853>, @Szelethus wrote:
> `CFGElementRef`
Wait, is it a thing already?? Did i miss anything???
> This analysis isn't conservative enough yet, I really should include function calls with non-const references into the gen set, but hey, at this point I'm optimistic that it can be done.
"Conservative" is not a property of the algorithm; it depends on how is the algorithm used. For some purposes you'll want to add an extra definition when you're not sure if it'll be a definition, for other purposes you'll want to only have definitions in which you are 100% certain in the set.
================
Comment at: clang/lib/Analysis/ReachingDefinitions.cpp:68
+ auto Assignments =
+ match(stmt(forEachDescendant(AssignmentM)), *S, *Context);
+ if (!Assignments.empty()) {
----------------
I don't think you really need this. Every assignment would anyway appear in the CFG as a separate element. And also `forEachDescendant()` may accidentally scan items in different CFG blocks (i.e., if the whole statement is a `?:` or a logical op).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64991/new/
https://reviews.llvm.org/D64991
More information about the cfe-commits
mailing list