about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2020-03-19 17:46:51 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-04-08 10:13:20 +0100
commitfd1200a9ac4b3ea17f20c52ac1b7e5d549edbae1 (patch)
tree786cafc645b835824321eb68dab180a04c46038a
parent5918152b52b5f9a4470834a97091308df69cdc67 (diff)
downloadklee-fd1200a9ac4b3ea17f20c52ac1b7e5d549edbae1.tar.gz
Statistic: slightly modernise class definition
-rw-r--r--include/klee/Statistic.h23
-rw-r--r--lib/Basic/Statistics.cpp13
2 files changed, 14 insertions, 22 deletions
diff --git a/include/klee/Statistic.h b/include/klee/Statistic.h
index 6adefdad..bbb67116 100644
--- a/include/klee/Statistic.h
+++ b/include/klee/Statistic.h
@@ -10,8 +10,6 @@
 #ifndef KLEE_STATISTIC_H
 #define KLEE_STATISTIC_H
 
-#include "klee/Config/Version.h"
-#include "llvm/Support/DataTypes.h"
 #include <string>
 
 namespace klee {
@@ -25,22 +23,21 @@ namespace klee {
   /// not the actual values. Values are managed by the global
   /// StatisticManager to enable transparent support for instruction
   /// level and call path level statistics.
-  class Statistic {
+  class Statistic final {
     friend class StatisticManager;
     friend class StatisticRecord;
 
   private:
-    unsigned id;
+    std::uint32_t id;
     const std::string name;
     const std::string shortName;
 
   public:
-    Statistic(const std::string &_name, 
-              const std::string &_shortName);
-    ~Statistic();
+    Statistic(const std::string &name, const std::string &shortName);
+    ~Statistic() = default;
 
     /// getID - Get the unique statistic ID.
-    unsigned getID() { return id; }
+    std::uint32_t getID() const { return id; }
 
     /// getName - Get the statistic name.
     const std::string &getName() const { return name; }
@@ -50,16 +47,16 @@ namespace klee {
     const std::string &getShortName() const { return shortName; }
 
     /// getValue - Get the current primary statistic value.
-    uint64_t getValue() const;
+    std::uint64_t getValue() const;
 
-    /// operator uint64_t - Get the current primary statistic value.
-    operator uint64_t () const { return getValue(); }
+    /// operator std::uint64_t - Get the current primary statistic value.
+    operator std::uint64_t() const { return getValue(); }
 
     /// operator++ - Increment the statistic by 1.
-    Statistic &operator ++() { return (*this += 1); }
+    Statistic &operator++() { return (*this += 1); }
 
     /// operator+= - Increment the statistic by \arg addend.
-    Statistic &operator +=(const uint64_t addend);
+    Statistic &operator+=(std::uint64_t addend);
   };
 }
 
diff --git a/lib/Basic/Statistics.cpp b/lib/Basic/Statistics.cpp
index 402b0e5a..954051ea 100644
--- a/lib/Basic/Statistics.cpp
+++ b/lib/Basic/Statistics.cpp
@@ -64,21 +64,16 @@ static StatisticManager &getStatisticManager() {
 
 /* *** */
 
-Statistic::Statistic(const std::string &_name, 
-                     const std::string &_shortName) 
-  : name(_name), 
-    shortName(_shortName) {
+Statistic::Statistic(const std::string &name, const std::string &shortName)
+  : name{name}, shortName{shortName} {
   getStatisticManager().registerStatistic(*this);
 }
 
-Statistic::~Statistic() {
-}
-
-Statistic &Statistic::operator +=(const uint64_t addend) {
+Statistic &Statistic::operator+=(std::uint64_t addend) {
   theStatisticManager->incrementStatistic(*this, addend);
   return *this;
 }
 
-uint64_t Statistic::getValue() const {
+std::uint64_t Statistic::getValue() const {
   return theStatisticManager->getValue(*this);
 }