]> granicus.if.org Git - clang/commit
[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock
authorKristof Umann <dkszelethus@gmail.com>
Wed, 14 Aug 2019 17:05:55 +0000 (17:05 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Wed, 14 Aug 2019 17:05:55 +0000 (17:05 +0000)
commitf6a49c4be89f8ca89f4b7ab96f08e6a0d8aabd66
tree1f56542e416329013c0c0da1956634499bb9e69d
parentda781a67c9d3d916c9495db9924dd594534d2087
[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock

Previously, collecting CFGElements in a set was practially impossible, because
both CFGBlock::operator[] and both the iterators returned it by value. One
workaround would be to collect the iterators instead, but they don't really
capture the concept of an element, and elements from different iterator types are incomparable.

This patch introduces CFGElementRef, a wrapper around a (CFGBlock, Index) pair,
and a variety of new iterators and iterator ranges to solve this problem.

I guess you could say that this patch took a couple iterations to get right :^)

Differential Revision: https://reviews.llvm.org/D65196

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368883 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/CFG.h
lib/Analysis/CFG.cpp
unittests/Analysis/CFGTest.cpp