diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-13 04:56:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-13 04:56:13 +0000 |
commit | 9eb49a40df510313132eef147419c5abefff23eb (patch) | |
tree | b1ecd786e63dcb9726d39b2321a930e5df82e123 /include/clang/Analysis/PathSensitive/ExplodedGraph.h | |
parent | 4c4cb527a44037d076da82ad9d12b4e655e64dbb (diff) |
Created ExplodedGraph.cpp and moved most method implementations of
ExplodedNodeImpl::NodeGroup from being defined inline to being defined
"out-of-line" in ExplodedGraph.cpp. This removes a dependence on including
<vector> in ExplodedGraph.h, and will hopefully result in smaller generated code
with negligible performance impact.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/ExplodedGraph.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/ExplodedGraph.h | 61 |
1 files changed, 8 insertions, 53 deletions
diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index 24bb1cb54f..fbd0a24415 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -39,68 +39,23 @@ protected: uintptr_t P; unsigned getKind() const { return P & Flags; } - - std::vector<ExplodedNodeImpl*>& getVector() { - assert (getKind() == SizeOther); - return *reinterpret_cast<std::vector<ExplodedNodeImpl*>*>(P & ~Flags); - } - const std::vector<ExplodedNodeImpl*>& getVector() const { - assert (getKind() == SizeOther); - return *reinterpret_cast<std::vector<ExplodedNodeImpl*>*>(P & ~Flags); - } - - ExplodedNodeImpl* getNode() const { - assert (getKind() == Size1); - return reinterpret_cast<ExplodedNodeImpl*>(P); - } + void* getPtr() const { return reinterpret_cast<void*>(P & ~Flags); } + ExplodedNodeImpl* getNode() const; public: NodeGroup() : P(0) {} - ~NodeGroup() { if (getKind() == SizeOther) delete &getVector(); } + ~NodeGroup(); - inline ExplodedNodeImpl** begin() const { - if (getKind() == Size1) - return (ExplodedNodeImpl**) &P; - else - return const_cast<ExplodedNodeImpl**>(&*(getVector().begin())); - } + inline ExplodedNodeImpl** begin() const; - inline ExplodedNodeImpl** end() const { - if (getKind() == Size1) - return ((ExplodedNodeImpl**) &P)+1; - else - return const_cast<ExplodedNodeImpl**>(&*(getVector().rbegin())+1); - } + inline ExplodedNodeImpl** end() const; - inline unsigned size() const { - if (getKind() == Size1) - return getNode() ? 1 : 0; - else - return getVector().size(); - } + inline unsigned size() const; - inline bool empty() const { - if (getKind() == Size1) - return getNode() ? false : true; - else - return getVector().empty(); - } + inline bool empty() const; - inline void addNode(ExplodedNodeImpl* N) { - if (getKind() == Size1) { - if (ExplodedNodeImpl* NOld = getNode()) { - std::vector<ExplodedNodeImpl*>* V = new std::vector<ExplodedNodeImpl*>(); - V->push_back(NOld); - V->push_back(N); - P = reinterpret_cast<uintptr_t>(V) & SizeOther; - } - else - P = reinterpret_cast<uintptr_t>(N); - } - else - getVector().push_back(N); - } + void addNode(ExplodedNodeImpl* N); }; |