about summary refs log tree commit diff homepage
path: root/lib/Core/CallPathManager.h
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2018-08-07 17:03:22 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-03-19 15:37:46 +0000
commitd5ce6b3b2c62badebc7534550f09f1b5592a7aa3 (patch)
treeb8733065d645291db4ee0728b834c8dfc48fd42e /lib/Core/CallPathManager.h
parent488e65f76e49e28e3db1a845276bf3dac49a2dc1 (diff)
downloadklee-d5ce6b3b2c62badebc7534550f09f1b5592a7aa3.tar.gz
Refactor InstructionInfoTable
Better debug information
Diffstat (limited to 'lib/Core/CallPathManager.h')
-rw-r--r--lib/Core/CallPathManager.h43
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/Core/CallPathManager.h b/lib/Core/CallPathManager.h
index 2e16d72b..0a648777 100644
--- a/lib/Core/CallPathManager.h
+++ b/lib/Core/CallPathManager.h
@@ -13,6 +13,7 @@
 #include "klee/Statistics.h"
 
 #include <map>
+#include <memory>
 #include <vector>
 
 namespace llvm {
@@ -31,20 +32,23 @@ namespace klee {
     CallSiteInfo() : count(0) {}
   };
 
-  typedef std::map<llvm::Instruction*,
-                   std::map<llvm::Function*, CallSiteInfo> > CallSiteSummaryTable;    
-  
+  typedef std::map<const llvm::Instruction *,
+                   std::map<const llvm::Function *, CallSiteInfo>>
+      CallSiteSummaryTable;
+
   class CallPathNode {
     friend class CallPathManager;
 
   public:
-    typedef std::map<std::pair<llvm::Instruction*, 
-                               llvm::Function*>, CallPathNode*> children_ty;
+    typedef std::map<
+        std::pair<const llvm::Instruction *, const llvm::Function *>,
+        CallPathNode *>
+        children_ty;
 
     // form list of (callSite,function) path
     CallPathNode *parent;
-    llvm::Instruction *callSite;
-    llvm::Function *function;
+    const llvm::Instruction *callSite;
+    const llvm::Function *function;
     children_ty children;
 
     StatisticRecord statistics;
@@ -52,31 +56,30 @@ namespace klee {
     unsigned count;
 
   public:
-    CallPathNode(CallPathNode *parent, 
-                 llvm::Instruction *callSite,
-                 llvm::Function *function);
+    CallPathNode(CallPathNode *parent, const llvm::Instruction *callSite,
+                 const llvm::Function *function);
 
     void print();
   };
 
   class CallPathManager {
     CallPathNode root;
-    std::vector<CallPathNode*> paths;
+    std::vector<std::unique_ptr<CallPathNode>> paths;
 
   private:
-    CallPathNode *computeCallPath(CallPathNode *parent, 
-                                  llvm::Instruction *callSite,
-                                  llvm::Function *f);
-    
+    CallPathNode *computeCallPath(CallPathNode *parent,
+                                  const llvm::Instruction *callSite,
+                                  const llvm::Function *f);
+
   public:
     CallPathManager();
-    ~CallPathManager();
+    ~CallPathManager() = default;
 
     void getSummaryStatistics(CallSiteSummaryTable &result);
-    
-    CallPathNode *getCallPath(CallPathNode *parent, 
-                              llvm::Instruction *callSite,
-                              llvm::Function *f);
+
+    CallPathNode *getCallPath(CallPathNode *parent,
+                              const llvm::Instruction *callSite,
+                              const llvm::Function *f);
   };
 }