diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-23 23:20:36 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-23 23:20:36 +0000 |
commit | 807c1bc84737bd27d739dddf07b8597098bfc6b2 (patch) | |
tree | 5023af755e35500c43e0ad1cb71d290ad91c1b0d /include | |
parent | 31d2477c683f3c411195a896b852af286d49cfcb (diff) | |
download | llvm-807c1bc84737bd27d739dddf07b8597098bfc6b2.tar.gz llvm-807c1bc84737bd27d739dddf07b8597098bfc6b2.tar.bz2 llvm-807c1bc84737bd27d739dddf07b8597098bfc6b2.tar.xz |
[LCG] Make the insertion and query paths into the LCG which cannot fail
return references to better model this property.
No functionality changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/LazyCallGraph.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/llvm/Analysis/LazyCallGraph.h b/include/llvm/Analysis/LazyCallGraph.h index 0bbf591a6c..1b0e1dbf27 100644 --- a/include/llvm/Analysis/LazyCallGraph.h +++ b/include/llvm/Analysis/LazyCallGraph.h @@ -142,9 +142,9 @@ public: return NI->get<Node *>(); Function *F = NI->get<Function *>(); - Node *ChildN = G->get(*F); - *NI = ChildN; - return ChildN; + Node &ChildN = G->get(*F); + *NI = &ChildN; + return &ChildN; } pointer operator->() const { return operator*(); } @@ -332,10 +332,10 @@ public: /// \brief Get a graph node for a given function, scanning it to populate the /// graph data as necessary. - Node *get(Function &F) { + Node &get(Function &F) { Node *&N = NodeMap[&F]; if (N) - return N; + return *N; return insertInto(F, N); } @@ -345,7 +345,7 @@ public: /// \brief Update the call graph after deleting an edge. void removeEdge(Function &Caller, Function &Callee) { - return removeEdge(*get(Caller), Callee); + return removeEdge(get(Caller), Callee); } private: @@ -387,7 +387,7 @@ private: /// \brief Helper to insert a new function, with an already looked-up entry in /// the NodeMap. - Node *insertInto(Function &F, Node *&MappedN); + Node &insertInto(Function &F, Node *&MappedN); /// \brief Helper to update pointers back to the graph object during moves. void updateGraphPtrs(); |