]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove unnecessary Result::Writer destructor
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 22 Sep 2020 17:44:25 +0000 (19:44 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 23 Sep 2020 07:52:21 +0000 (09:52 +0200)
The destructor may throw exceptions and since it’s superfluous we can
just remove it.

src/Result.cpp
src/Result.hpp

index e2311ec22867649b524c3709ab216a3e0496cb71..8af93fbb20179ffe663998d769323c408dfa4426 100644 (file)
@@ -282,13 +282,6 @@ Writer::Writer(Context& ctx, const std::string& result_path)
 {
 }
 
-Writer::~Writer()
-{
-  if (!m_finalized) {
-    finalize();
-  }
-}
-
 void
 Writer::write(FileType file_type, const std::string& file_path)
 {
@@ -298,7 +291,6 @@ Writer::write(FileType file_type, const std::string& file_path)
 optional<std::string>
 Writer::finalize()
 {
-  m_finalized = true;
   try {
     do_finalize();
     return nullopt;
index 511afd2b38006090fcbd3129652e02e2c672da04..e8e6f97a86650a9d06df0be19b2f0782eac28b13 100644 (file)
@@ -91,7 +91,6 @@ class Writer
 {
 public:
   Writer(Context& ctx, const std::string& result_path);
-  ~Writer();
 
   // Register a file to include in the result. Does not throw.
   void write(FileType file_type, const std::string& file_path);
@@ -102,7 +101,6 @@ public:
 private:
   Context& m_ctx;
   const std::string m_result_path;
-  bool m_finalized = false;
   std::vector<std::pair<FileType, std::string>> m_entries_to_write;
 
   void do_finalize();