Constness changes
authorChris Lattner <sabre@nondot.org>
Mon, 30 Jun 2003 05:10:09 +0000 (05:10 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 30 Jun 2003 05:10:09 +0000 (05:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7002 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DataStructure.h
include/llvm/Analysis/DataStructure/DataStructure.h

index c69c341dfd73968ee2db4d6ec64dd8076803520d..354728f5a65d9cc6d4e2b21e428e0433cffd316f 100644 (file)
@@ -33,7 +33,7 @@ namespace DataStructureAnalysis {
 //
 class LocalDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
 public:
   ~LocalDataStructures() { releaseMemory(); }
@@ -41,12 +41,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }
@@ -72,7 +73,7 @@ public:
 //
 class BUDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
 public:
   ~BUDataStructures() { releaseMemory(); }
@@ -80,12 +81,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }
@@ -103,7 +105,7 @@ public:
     AU.addRequired<LocalDataStructures>();
   }
 private:
-  DSGraph &calculateGraph(Function &F);
+  void calculateGraph(DSGraph &G);
 
   // inlineNonSCCGraphs - This method is almost like the other two calculate
   // graph methods.  This one is used to inline function graphs (from functions
@@ -132,7 +134,7 @@ private:
 //
 class TDDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   hash_set<const Function*> GraphDone;
   DSGraph *GlobalsGraph;
 public:
@@ -141,12 +143,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }
index c69c341dfd73968ee2db4d6ec64dd8076803520d..354728f5a65d9cc6d4e2b21e428e0433cffd316f 100644 (file)
@@ -33,7 +33,7 @@ namespace DataStructureAnalysis {
 //
 class LocalDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
 public:
   ~LocalDataStructures() { releaseMemory(); }
@@ -41,12 +41,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }
@@ -72,7 +73,7 @@ public:
 //
 class BUDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
 public:
   ~BUDataStructures() { releaseMemory(); }
@@ -80,12 +81,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }
@@ -103,7 +105,7 @@ public:
     AU.addRequired<LocalDataStructures>();
   }
 private:
-  DSGraph &calculateGraph(Function &F);
+  void calculateGraph(DSGraph &G);
 
   // inlineNonSCCGraphs - This method is almost like the other two calculate
   // graph methods.  This one is used to inline function graphs (from functions
@@ -132,7 +134,7 @@ private:
 //
 class TDDataStructures : public Pass {
   // DSInfo, one graph for each function
-  hash_map<const Function*, DSGraph*> DSInfo;
+  hash_map<Function*, DSGraph*> DSInfo;
   hash_set<const Function*> GraphDone;
   DSGraph *GlobalsGraph;
 public:
@@ -141,12 +143,13 @@ public:
   virtual bool run(Module &M);
 
   bool hasGraph(const Function &F) const {
-    return DSInfo.find(&F) != DSInfo.end();
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
   }
 
   // getDSGraph - Return the data structure graph for the specified function.
   DSGraph &getDSGraph(const Function &F) const {
-    hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
     assert(I != DSInfo.end() && "Function not in module!");
     return *I->second;
   }