about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2020-06-25 11:06:22 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-07-29 14:04:32 +0100
commit169022a56d62cdb2f15540a0c592c5f90fdb39cb (patch)
tree0265487e3989360c75d439b79674be0caf944f8c
parent8d89546353180aa51484c27be68ffb0bb10583cd (diff)
downloadklee-169022a56d62cdb2f15540a0c592c5f90fdb39cb.tar.gz
remove holes in Instruction-/FunctionInfoTable, add documentation
-rw-r--r--include/klee/Module/InstructionInfoTable.h31
-rw-r--r--lib/Module/InstructionInfoTable.cpp16
2 files changed, 27 insertions, 20 deletions
diff --git a/include/klee/Module/InstructionInfoTable.h b/include/klee/Module/InstructionInfoTable.h
index e3684802..3ba9528c 100644
--- a/include/klee/Module/InstructionInfoTable.h
+++ b/include/klee/Module/InstructionInfoTable.h
@@ -23,32 +23,39 @@ namespace llvm {
 
 namespace klee {
 
-  /* Stores debug information for a KInstruction */
+  /// @brief InstructionInfo stores debug information for a KInstruction.
   struct InstructionInfo {
+    /// @brief The instruction id.
     unsigned id;
-    const std::string &file;
+    /// @brief Line number in source file.
     unsigned line;
+    /// @brief Column number in source file.
     unsigned column;
+    /// @brief Line number in generated assembly.ll.
     unsigned assemblyLine;
+    /// @brief Source file name.
+    const std::string &file;
 
   public:
-    InstructionInfo(unsigned _id, const std::string &_file, unsigned _line,
-                    unsigned _column, unsigned _assemblyLine)
-        : id(_id), file(_file), line(_line), column(_column),
-          assemblyLine(_assemblyLine) {}
+    InstructionInfo(unsigned id, const std::string &file, unsigned line,
+                    unsigned column, unsigned assemblyLine)
+        : id{id}, line{line}, column{column}, assemblyLine{assemblyLine}, file{file} {}
   };
 
-  /* Stores debug information for a KInstruction */
+  /// @brief FunctionInfo stores debug information for a KFunction.
   struct FunctionInfo {
+    /// @brief The function id.
     unsigned id;
-    const std::string &file;
+    /// @brief Line number in source file.
     unsigned line;
+    /// @brief Line number in generated assembly.ll.
     uint64_t assemblyLine;
+    /// @brief Source file name.
+    const std::string &file;
 
   public:
-    FunctionInfo(unsigned _id, const std::string &_file, unsigned _line,
-                 uint64_t _assemblyLine)
-        : id(_id), file(_file), line(_line), assemblyLine(_assemblyLine) {}
+    FunctionInfo(unsigned id, const std::string &file, unsigned line, uint64_t assemblyLine)
+        : id{id}, line{line}, assemblyLine{assemblyLine}, file{file} {}
 
     FunctionInfo(const FunctionInfo &) = delete;
     FunctionInfo &operator=(FunctionInfo const &) = delete;
@@ -65,7 +72,7 @@ namespace klee {
     std::vector<std::unique_ptr<std::string>> internedStrings;
 
   public:
-    InstructionInfoTable(const llvm::Module &m);
+    explicit InstructionInfoTable(const llvm::Module &m);
 
     unsigned getMaxID() const;
     const InstructionInfo &getInfo(const llvm::Instruction &) const;
diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp
index 44c7a294..fde5ff19 100644
--- a/lib/Module/InstructionInfoTable.cpp
+++ b/lib/Module/InstructionInfoTable.cpp
@@ -119,13 +119,13 @@ public:
 #endif
     if (dsub != nullptr) {
       auto path = dsub->getFilename();
-      return std::unique_ptr<FunctionInfo>(new FunctionInfo(
+      return std::make_unique<FunctionInfo>(FunctionInfo(
           0, getInternedString(path), dsub->getLine(), asmLine));
     }
 
     // Fallback: Mark as unknown
-    return std::unique_ptr<FunctionInfo>(
-        new FunctionInfo(0, getInternedString(""), 0, asmLine));
+    return std::make_unique<FunctionInfo>(
+        FunctionInfo(0, getInternedString(""), 0, asmLine));
   }
 
   std::unique_ptr<InstructionInfo>
@@ -150,17 +150,17 @@ public:
           column = LexicalBlock->getColumn();
         }
       }
-      return std::unique_ptr<InstructionInfo>(new InstructionInfo(
+      return std::make_unique<InstructionInfo>(InstructionInfo(
           0, getInternedString(full_path), line, column, asmLine));
     }
 
     if (f != nullptr)
       // If nothing found, use the surrounding function
-      return std::unique_ptr<InstructionInfo>(
-          new InstructionInfo(0, f->file, f->line, 0, asmLine));
+      return std::make_unique<InstructionInfo>(
+          InstructionInfo(0, f->file, f->line, 0, asmLine));
     // If nothing found, use the surrounding function
-    return std::unique_ptr<InstructionInfo>(
-        new InstructionInfo(0, getInternedString(""), 0, 0, asmLine));
+    return std::make_unique<InstructionInfo>(
+        InstructionInfo(0, getInternedString(""), 0, 0, asmLine));
   }
 };