summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-20 18:59:46 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-20 18:59:46 +0000
commit2b10f3f8a98ab5869aa395ffcf348baf11bc9d59 (patch)
tree7b1efafb3ea15f3e78ba8f1224bf1e533ac69d34 /clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
parent4b4613cbeccd9810be91ad2d52005b8862530633 (diff)
downloadbcm5719-llvm-2b10f3f8a98ab5869aa395ffcf348baf11bc9d59.tar.gz
bcm5719-llvm-2b10f3f8a98ab5869aa395ffcf348baf11bc9d59.zip
[analyzer] Add comments to ExplodedNode::NodeGroup.
No functionality change. llvm-svn: 162216
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 24d1c094d0f..9145565d3a0 100644
--- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud