Add const version of function getNodeForValue:
authorVikram S. Adve <vadve@cs.uiuc.edu>
Wed, 6 Nov 2002 17:00:41 +0000 (17:00 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Wed, 6 Nov 2002 17:00:41 +0000 (17:00 +0000)
  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
include/llvm/Analysis/DataStructure/DSGraph.h

index 3891c0e70d3030b410865d953655f903bdd578b7..a2687438ce387e166094c27a4fd90a3ef2b42748 100644 (file)
@@ -76,6 +76,13 @@ public:
   ///
   DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; }
 
+  const DSNodeHandle &getNodeForValue(Value *V) const {
+    std::map<Value*, DSNodeHandle>::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; }
 
index 3891c0e70d3030b410865d953655f903bdd578b7..a2687438ce387e166094c27a4fd90a3ef2b42748 100644 (file)
@@ -76,6 +76,13 @@ public:
   ///
   DSNodeHandle &getNodeForValue(Value *V) { return ScalarMap[V]; }
 
+  const DSNodeHandle &getNodeForValue(Value *V) const {
+    std::map<Value*, DSNodeHandle>::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; }