From db7ab14434a7b15911c850ebdf740b0d8ebbb9e4 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Wed, 6 Nov 2002 17:00:41 +0000 Subject: [PATCH] Add const version of function getNodeForValue: const DSNodeHandle &getNodeForValue(Value *V) const. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4566 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DSGraph.h | 7 +++++++ include/llvm/Analysis/DataStructure/DSGraph.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h index 3891c0e70d3..a2687438ce3 100644 --- a/include/llvm/Analysis/DSGraph.h +++ b/include/llvm/Analysis/DSGraph.h @@ -76,6 +76,13 @@ public: /// DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; } + const DSNodeHandle &getNodeForValue(Value *V) const { + std::map::const_iterator I = ScalarMap.find(V); + assert(I != ScalarMap.end() && + "Use non-const lookup function if node may not be in the map"); + return I->second; + } + const DSNodeHandle &getRetNode() const { return RetNode; } DSNodeHandle &getRetNode() { return RetNode; } diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 3891c0e70d3..a2687438ce3 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -76,6 +76,13 @@ public: /// DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; } + const DSNodeHandle &getNodeForValue(Value *V) const { + std::map::const_iterator I = ScalarMap.find(V); + assert(I != ScalarMap.end() && + "Use non-const lookup function if node may not be in the map"); + return I->second; + } + const DSNodeHandle &getRetNode() const { return RetNode; } DSNodeHandle &getRetNode() { return RetNode; }