diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-08-20 18:59:46 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-08-20 18:59:46 +0000 |
commit | 1833d284346b9fa11aae4e6aa07381347c04745c (patch) | |
tree | 30abec95bd6d1a3f5790a64d42699e0dcfbe2e83 /lib/StaticAnalyzer/Core/ExplodedGraph.cpp | |
parent | fa06f0464a04bb7fce1fcfb3780d151bb029e00c (diff) |
[analyzer] Add comments to ExplodedNode::NodeGroup.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExplodedGraph.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/ExplodedGraph.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp index 24d1c094d0..9145565d3a 100644 --- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp +++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp @@ -162,6 +162,16 @@ void ExplodedGraph::reclaimRecentlyAllocatedNodes() { // ExplodedNode. //===----------------------------------------------------------------------===// +// An NodeGroup's storage type is actually very much like a TinyPtrVector: +// it can be either a pointer to a single ExplodedNode, or a pointer to a +// BumpVector allocated with the ExplodedGraph's allocator. This allows the +// common case of single-node NodeGroups to be implemented with no extra memory. +// +// Consequently, each of the NodeGroup methods have up to four cases to handle: +// 1. The flag is set and this group does not actually contain any nodes. +// 2. The group is empty, in which case the storage value is null. +// 3. The group contains a single node. +// 4. The group contains more than one node. typedef BumpVector<ExplodedNode *> ExplodedNodeVector; typedef llvm::PointerUnion<ExplodedNode *, ExplodedNodeVector *> GroupStorage; @@ -175,6 +185,8 @@ void ExplodedNode::addPredecessor(ExplodedNode *V, ExplodedGraph &G) { } void ExplodedNode::NodeGroup::replaceNode(ExplodedNode *node) { + assert(!getFlag()); + GroupStorage &Storage = reinterpret_cast<GroupStorage&>(P); assert(Storage.is<ExplodedNode *>()); Storage = node; |