aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Huang <huangs@chromium.org>2021-08-13 15:42:26 +0000
committerCopybara-Service <copybara-worker@google.com>2021-08-13 08:54:54 -0700
commitf137bf4b5542b966abc4c08762c5e60b21913f4d (patch)
tree09c6bdbdfaa7dd2f09d32a791a6aa364b0eeb2ba
parentfa10b05c4854c6d8a603ee47c2a213cbc23f8646 (diff)
downloadzucchini-f137bf4b5542b966abc4c08762c5e60b21913f4d.tar.gz
[Zucchini] Replace DISALLOW_* macros with =delete versions.
This CL replaces * 30 instances of DISALLOW_COPY_AND_ASSIGN(Foo), * 1 instance of DISALLOW_IMPLICIT_CONSTRUCTORS(Foo), in Zucchini with: Foo() = delete; // DISALLOW_IMPLICIT_CONSTRUCTORS only. Foo(const Foo&) = delete; const Foo& operator=(const Foo&) = delete; All base/macros.h includes are removed. Bug: 1010217 Change-Id: I13b3d5ed04f04e5c0b209d59e70ac018c5f4938c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3093198 Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#911751} NOKEYCHECK=True GitOrigin-RevId: ba0e1f56993c535faa59e2ca02c371bae2ebbb20
-rw-r--r--abs32_utils.h9
-rw-r--r--binary_data_histogram.h9
-rw-r--r--disassembler.h5
-rw-r--r--disassembler_dex.cc5
-rw-r--r--disassembler_dex.h5
-rw-r--r--disassembler_no_op.h5
-rw-r--r--disassembler_win32.h5
-rw-r--r--disassembler_ztf.cc10
-rw-r--r--disassembler_ztf.h8
-rw-r--r--element_detection.h5
-rw-r--r--encoded_view.h5
-rw-r--r--ensemble_matcher.h6
-rw-r--r--heuristic_ensemble_matcher.cc16
-rw-r--r--heuristic_ensemble_matcher.h6
-rw-r--r--image_utils.h1
-rw-r--r--imposed_ensemble_matcher.h10
-rw-r--r--io_utils.h14
-rw-r--r--mapped_file.h9
-rw-r--r--patch_writer.h5
-rw-r--r--reference_set.cc1
-rw-r--r--suffix_array.h6
-rw-r--r--targets_affinity.h5
-rw-r--r--test_disassembler.h5
-rw-r--r--zucchini_commands.cc1
24 files changed, 69 insertions, 87 deletions
diff --git a/abs32_utils.h b/abs32_utils.h
index f13f562..07503b5 100644
--- a/abs32_utils.h
+++ b/abs32_utils.h
@@ -10,7 +10,6 @@
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/address_translator.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/image_utils.h"
@@ -94,6 +93,8 @@ class Abs32ReaderWin32 : public ReferenceReader {
public:
Abs32ReaderWin32(Abs32RvaExtractorWin32&& abs32_rva_extractor,
const AddressTranslator& translator);
+ Abs32ReaderWin32(const Abs32ReaderWin32&) = delete;
+ const Abs32ReaderWin32& operator=(const Abs32ReaderWin32&) = delete;
~Abs32ReaderWin32() override;
// ReferenceReader:
@@ -102,8 +103,6 @@ class Abs32ReaderWin32 : public ReferenceReader {
private:
Abs32RvaExtractorWin32 abs32_rva_extractor_;
AddressTranslator::RvaToOffsetCache target_rva_to_offset_;
-
- DISALLOW_COPY_AND_ASSIGN(Abs32ReaderWin32);
};
// A writer for Win32 abs32 references. |addr| determines the bitness of the
@@ -113,6 +112,8 @@ class Abs32WriterWin32 : public ReferenceWriter {
Abs32WriterWin32(MutableBufferView image,
AbsoluteAddress&& addr,
const AddressTranslator& translator);
+ Abs32WriterWin32(const Abs32WriterWin32&) = delete;
+ const Abs32WriterWin32& operator=(const Abs32WriterWin32&) = delete;
~Abs32WriterWin32() override;
// ReferenceWriter:
@@ -122,8 +123,6 @@ class Abs32WriterWin32 : public ReferenceWriter {
MutableBufferView image_;
AbsoluteAddress addr_;
AddressTranslator::OffsetToRvaCache target_offset_to_rva_;
-
- DISALLOW_COPY_AND_ASSIGN(Abs32WriterWin32);
};
// Given a list of abs32 |locations|, removes all elements whose targets cannot
diff --git a/binary_data_histogram.h b/binary_data_histogram.h
index 3950ab7..201f90a 100644
--- a/binary_data_histogram.h
+++ b/binary_data_histogram.h
@@ -11,7 +11,6 @@
#include <memory>
#include <string>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
namespace zucchini {
@@ -24,6 +23,8 @@ namespace zucchini {
class OutlierDetector {
public:
OutlierDetector();
+ OutlierDetector(const OutlierDetector&) = delete;
+ const OutlierDetector& operator=(const OutlierDetector&) = delete;
~OutlierDetector();
// Incorporates |sample| into mean and standard deviation.
@@ -47,8 +48,6 @@ class OutlierDetector {
double sum_of_squares_ = 0;
double mean_ = 0;
double standard_deviation_ = 0;
-
- DISALLOW_COPY_AND_ASSIGN(OutlierDetector);
};
// A class to compute similarity score between binary data. The heuristic here
@@ -58,6 +57,8 @@ class OutlierDetector {
class BinaryDataHistogram {
public:
BinaryDataHistogram();
+ BinaryDataHistogram(const BinaryDataHistogram&) = delete;
+ const BinaryDataHistogram& operator=(const BinaryDataHistogram&) = delete;
~BinaryDataHistogram();
// Attempts to compute the histogram, returns true iff successful.
@@ -82,8 +83,6 @@ class BinaryDataHistogram {
// are stored as signed values to simplify computing the distance between two
// histograms.
std::unique_ptr<int32_t[]> histogram_;
-
- DISALLOW_COPY_AND_ASSIGN(BinaryDataHistogram);
};
} // namespace zucchini
diff --git a/disassembler.h b/disassembler.h
index 8fd5a3a..48ee0fb 100644
--- a/disassembler.h
+++ b/disassembler.h
@@ -11,7 +11,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/image_utils.h"
@@ -54,6 +53,8 @@ class Disassembler {
return disasm;
}
+ Disassembler(const Disassembler&) = delete;
+ const Disassembler& operator=(const Disassembler&) = delete;
virtual ~Disassembler();
// Returns the type of executable handled by the Disassembler.
@@ -85,8 +86,6 @@ class Disassembler {
// The number of iterations to run for equivalence map generation. This should
// roughly be the max length of reference indirection chains.
int num_equivalence_iterations_;
-
- DISALLOW_COPY_AND_ASSIGN(Disassembler);
};
// A ReferenceGroup is associated with a specific |type| and has convenience
diff --git a/disassembler_dex.cc b/disassembler_dex.cc
index a835fb2..5b25c50 100644
--- a/disassembler_dex.cc
+++ b/disassembler_dex.cc
@@ -630,6 +630,9 @@ class CachedItemListReferenceReader : public ReferenceReader {
if (cur_it_ != item_offsets.begin() && *(cur_it_ - 1) + rel_location_ >= lo)
--cur_it_;
}
+ CachedItemListReferenceReader(const CachedItemListReferenceReader&) = delete;
+ const CachedItemListReferenceReader& operator=(
+ const CachedItemListReferenceReader&) = delete;
// ReferenceReader:
absl::optional<Reference> GetNext() override {
@@ -659,8 +662,6 @@ class CachedItemListReferenceReader : public ReferenceReader {
const std::vector<offset_t>::const_iterator end_it_;
const Mapper mapper_;
std::vector<offset_t>::const_iterator cur_it_;
-
- DISALLOW_COPY_AND_ASSIGN(CachedItemListReferenceReader);
};
// Reads an INT index at |location| in |image| and translates the index to the
diff --git a/disassembler_dex.h b/disassembler_dex.h
index ecc4be6..2038a3c 100644
--- a/disassembler_dex.h
+++ b/disassembler_dex.h
@@ -12,7 +12,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/disassembler.h"
#include "components/zucchini/image_utils.h"
#include "components/zucchini/type_dex.h"
@@ -112,6 +111,8 @@ class DisassemblerDex : public Disassembler {
};
DisassemblerDex();
+ DisassemblerDex(const DisassemblerDex&) = delete;
+ const DisassemblerDex& operator=(const DisassemblerDex&) = delete;
~DisassemblerDex() override;
// Applies quick checks to determine if |image| *may* point to the start of an
@@ -265,8 +266,6 @@ class DisassemblerDex : public Disassembler {
std::vector<offset_t> annotations_directory_item_method_annotation_offsets_;
std::vector<offset_t>
annotations_directory_item_parameter_annotation_offsets_;
-
- DISALLOW_COPY_AND_ASSIGN(DisassemblerDex);
};
} // namespace zucchini
diff --git a/disassembler_no_op.h b/disassembler_no_op.h
index 280e8df..ef10651 100644
--- a/disassembler_no_op.h
+++ b/disassembler_no_op.h
@@ -9,7 +9,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/disassembler.h"
#include "components/zucchini/image_utils.h"
@@ -20,6 +19,8 @@ namespace zucchini {
class DisassemblerNoOp : public Disassembler {
public:
DisassemblerNoOp();
+ DisassemblerNoOp(const DisassemblerNoOp&) = delete;
+ const DisassemblerNoOp& operator=(const DisassemblerNoOp&) = delete;
~DisassemblerNoOp() override;
// Disassembler:
@@ -31,8 +32,6 @@ class DisassemblerNoOp : public Disassembler {
friend Disassembler;
bool Parse(ConstBufferView image) override;
-
- DISALLOW_COPY_AND_ASSIGN(DisassemblerNoOp);
};
} // namespace zucchini
diff --git a/disassembler_win32.h b/disassembler_win32.h
index d952014..77b65ac 100644
--- a/disassembler_win32.h
+++ b/disassembler_win32.h
@@ -14,7 +14,6 @@
#include <utility>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/address_translator.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/disassembler.h"
@@ -63,6 +62,8 @@ class DisassemblerWin32 : public Disassembler {
static bool QuickDetect(ConstBufferView image);
DisassemblerWin32();
+ DisassemblerWin32(const DisassemblerWin32&) = delete;
+ const DisassemblerWin32& operator=(const DisassemblerWin32&) = delete;
~DisassemblerWin32() override;
// Disassembler:
@@ -120,8 +121,6 @@ class DisassemblerWin32 : public Disassembler {
bool has_parsed_relocs_ = false;
bool has_parsed_abs32_ = false;
bool has_parsed_rel32_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32);
};
using DisassemblerWin32X86 = DisassemblerWin32<Win32X86Traits>;
diff --git a/disassembler_ztf.cc b/disassembler_ztf.cc
index f822d8b..dfe9045 100644
--- a/disassembler_ztf.cc
+++ b/disassembler_ztf.cc
@@ -11,7 +11,6 @@
#include <numeric>
#include "base/check_op.h"
-#include "base/macros.h"
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "components/zucchini/algorithm.h"
@@ -88,6 +87,9 @@ class ZtfParser {
ztf::kMaxDimValue);
}
+ ZtfParser(const ZtfParser&) = delete;
+ const ZtfParser& operator=(const ZtfParser&) = delete;
+
// Attempts to match an absolute reference at |offset|. If successful then
// assigns the result to |abs_lc| and returns true. Otherwise returns false.
// An absolute reference takes the form:
@@ -164,8 +166,6 @@ class ZtfParser {
const offset_t hi_;
const ZtfConfig config_;
offset_t offset_ = 0;
-
- DISALLOW_COPY_AND_ASSIGN(ZtfParser);
};
/******** ZtfWriter ********/
@@ -180,6 +180,9 @@ class ZtfWriter {
val_bound_(
static_cast<ztf::dim_t>(std::pow(10, config_.digits_per_dim))) {}
+ ZtfWriter(const ZtfWriter&) = delete;
+ const ZtfWriter& operator=(const ZtfWriter&) = delete;
+
// Write an absolute reference |abs_ref| at |offset|. Note that references
// that would overwrite a newline are skipped as this would invalidate all
// the other reference line numbers.
@@ -268,7 +271,6 @@ class ZtfWriter {
// Bound on numeric values, as limited by |config_.digits_per_dim|.
const ztf::dim_t val_bound_;
offset_t offset_ = 0;
- DISALLOW_COPY_AND_ASSIGN(ZtfWriter);
};
// Specialization of ReferenceReader for reading text references.
diff --git a/disassembler_ztf.h b/disassembler_ztf.h
index adbead5..0e73c2a 100644
--- a/disassembler_ztf.h
+++ b/disassembler_ztf.h
@@ -12,7 +12,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/disassembler.h"
#include "components/zucchini/image_utils.h"
#include "components/zucchini/type_ztf.h"
@@ -81,6 +80,8 @@ enum : size_t { kMaxDigitCount = 3 };
class ZtfTranslator {
public:
ZtfTranslator();
+ ZtfTranslator(const ZtfTranslator&) = delete;
+ const ZtfTranslator& operator=(const ZtfTranslator&) = delete;
~ZtfTranslator();
// Initializes |line_starts_| with the contents of |image|.
@@ -117,7 +118,6 @@ class ZtfTranslator {
// |line_starts_| is a sorted list of each line's starting offset, along with
// the image size as the sentinel; it looks like {0, ..., image.size}.
std::vector<offset_t> line_starts_;
- DISALLOW_COPY_AND_ASSIGN(ZtfTranslator);
};
// Disassembler for Zucchini Text Format (ZTF).
@@ -162,6 +162,8 @@ class DisassemblerZtf : public Disassembler {
};
DisassemblerZtf();
+ DisassemblerZtf(const DisassemblerZtf&) = delete;
+ const DisassemblerZtf& operator=(const DisassemblerZtf&) = delete;
~DisassemblerZtf() override;
// Applies quick checks to determine if |image| *may* point to the start of a
@@ -192,8 +194,6 @@ class DisassemblerZtf : public Disassembler {
bool Parse(ConstBufferView image) override;
ZtfTranslator translator_;
-
- DISALLOW_COPY_AND_ASSIGN(DisassemblerZtf);
};
} // namespace zucchini
diff --git a/element_detection.h b/element_detection.h
index d3dcb47..856ec27 100644
--- a/element_detection.h
+++ b/element_detection.h
@@ -10,7 +10,6 @@
#include <memory>
#include "base/callback.h"
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/image_utils.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -41,6 +40,8 @@ absl::optional<Element> DetectElementFromDisassembler(ConstBufferView image);
class ElementFinder {
public:
ElementFinder(ConstBufferView image, ElementDetector&& detector);
+ ElementFinder(const ElementFinder&) = delete;
+ const ElementFinder& operator=(const ElementFinder&) = delete;
~ElementFinder();
// Scans for the next executable using |detector|. Returns the next element
@@ -51,8 +52,6 @@ class ElementFinder {
ConstBufferView image_;
ElementDetector detector_;
offset_t pos_ = 0;
-
- DISALLOW_COPY_AND_ASSIGN(ElementFinder);
};
} // namespace zucchini
diff --git a/encoded_view.h b/encoded_view.h
index bd88099..864d265 100644
--- a/encoded_view.h
+++ b/encoded_view.h
@@ -11,7 +11,6 @@
#include <iterator>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/image_index.h"
#include "components/zucchini/image_utils.h"
@@ -136,6 +135,8 @@ class EncodedView {
// |image_index| is the annotated image being adapted, and is required to
// remain valid for the lifetime of the object.
explicit EncodedView(const ImageIndex& image_index);
+ EncodedView(const EncodedView&) = delete;
+ const EncodedView& operator=(const EncodedView&) = delete;
~EncodedView();
// Projects |location| to a scalar value that describes the content at a
@@ -177,8 +178,6 @@ class EncodedView {
const ImageIndex& image_index_;
std::vector<PoolInfo> pool_infos_;
-
- DISALLOW_COPY_AND_ASSIGN(EncodedView);
};
} // namespace zucchini
diff --git a/ensemble_matcher.h b/ensemble_matcher.h
index bc89883..b188657 100644
--- a/ensemble_matcher.h
+++ b/ensemble_matcher.h
@@ -9,7 +9,6 @@
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/element_detection.h"
#include "components/zucchini/image_utils.h"
@@ -29,6 +28,8 @@ namespace zucchini {
class EnsembleMatcher {
public:
EnsembleMatcher();
+ EnsembleMatcher(const EnsembleMatcher&) = delete;
+ const EnsembleMatcher& operator=(const EnsembleMatcher&) = delete;
virtual ~EnsembleMatcher();
// Interface to main matching feature. Returns whether match was successful.
@@ -52,9 +53,6 @@ class EnsembleMatcher {
// Number of identical matches found in match candidates. These should be
// excluded from |matches_|.
size_t num_identical_ = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(EnsembleMatcher);
};
} // namespace zucchini
diff --git a/heuristic_ensemble_matcher.cc b/heuristic_ensemble_matcher.cc
index c812cb4..2f01d34 100644
--- a/heuristic_ensemble_matcher.cc
+++ b/heuristic_ensemble_matcher.cc
@@ -83,6 +83,8 @@ std::ostream& operator<<(std::ostream& stream, const Element& elt) {
class MatchingInfoOut {
protected:
MatchingInfoOut() = default;
+ MatchingInfoOut(const MatchingInfoOut&) = delete;
+ const MatchingInfoOut& operator=(const MatchingInfoOut&) = delete;
public:
virtual ~MatchingInfoOut() = default;
@@ -108,9 +110,6 @@ class MatchingInfoOut {
virtual void OutputScores(const std::string& stats) {}
virtual void OutputTextGrid() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MatchingInfoOut);
};
/******** MatchingInfoTerse ********/
@@ -119,14 +118,13 @@ class MatchingInfoOut {
class MatchingInfoOutTerse : public MatchingInfoOut {
public:
MatchingInfoOutTerse() = default;
+ MatchingInfoOutTerse(const MatchingInfoOutTerse&) = delete;
+ const MatchingInfoOutTerse& operator=(const MatchingInfoOutTerse&) = delete;
~MatchingInfoOutTerse() override = default;
void OutputScores(const std::string& stats) override {
LOG(INFO) << "Best dists: " << stats;
}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MatchingInfoOutTerse);
};
/******** MatchingInfoOutVerbose ********/
@@ -137,6 +135,9 @@ class MatchingInfoOutTerse : public MatchingInfoOut {
class MatchingInfoOutVerbose : public MatchingInfoOut {
public:
explicit MatchingInfoOutVerbose(std::ostream& out) : out_(out) {}
+ MatchingInfoOutVerbose(const MatchingInfoOutVerbose&) = delete;
+ const MatchingInfoOutVerbose& operator=(const MatchingInfoOutVerbose&) =
+ delete;
~MatchingInfoOutVerbose() override = default;
// Outputs sizes and initializes |text_grid_|.
@@ -226,9 +227,6 @@ class MatchingInfoOutVerbose : public MatchingInfoOut {
// For each "new" element, distance of best match. -1 denotes no match.
std::vector<double> best_dist_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MatchingInfoOutVerbose);
};
} // namespace
diff --git a/heuristic_ensemble_matcher.h b/heuristic_ensemble_matcher.h
index 1adb998..ec40787 100644
--- a/heuristic_ensemble_matcher.h
+++ b/heuristic_ensemble_matcher.h
@@ -7,7 +7,6 @@
#include <ostream>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/ensemble_matcher.h"
@@ -22,6 +21,9 @@ namespace zucchini {
class HeuristicEnsembleMatcher : public EnsembleMatcher {
public:
explicit HeuristicEnsembleMatcher(std::ostream* out);
+ HeuristicEnsembleMatcher(const HeuristicEnsembleMatcher&) = delete;
+ const HeuristicEnsembleMatcher& operator=(const HeuristicEnsembleMatcher&) =
+ delete;
~HeuristicEnsembleMatcher() override;
// EnsembleMatcher:
@@ -30,8 +32,6 @@ class HeuristicEnsembleMatcher : public EnsembleMatcher {
private:
// Optional stream to print detailed information during matching.
std::ostream* out_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(HeuristicEnsembleMatcher);
};
} // namespace zucchini
diff --git a/image_utils.h b/image_utils.h
index d948a91..748e20b 100644
--- a/image_utils.h
+++ b/image_utils.h
@@ -11,7 +11,6 @@
#include <string>
#include "base/format_macros.h"
-#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "components/zucchini/buffer_view.h"
diff --git a/imposed_ensemble_matcher.h b/imposed_ensemble_matcher.h
index 4dfc38e..39b0df5 100644
--- a/imposed_ensemble_matcher.h
+++ b/imposed_ensemble_matcher.h
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/element_detection.h"
#include "components/zucchini/ensemble_matcher.h"
@@ -34,6 +33,8 @@ class ImposedMatchParser {
};
ImposedMatchParser();
+ ImposedMatchParser(const ImposedMatchParser&) = delete;
+ const ImposedMatchParser& operator=(const ImposedMatchParser&) = delete;
~ImposedMatchParser();
// Parses |imposed_matches| and writes the results to member variables.
@@ -57,8 +58,6 @@ class ImposedMatchParser {
// unsupported image types (which will simply be ignored). Note that imposing
// matches for known but incompatible image types would result in error.
std::vector<ElementMatch> bad_matches_;
-
- DISALLOW_COPY_AND_ASSIGN(ImposedMatchParser);
};
// An ensemble matcher that parses a format string that describes matches.
@@ -67,6 +66,9 @@ class ImposedEnsembleMatcher : public EnsembleMatcher {
// |imposed_matches| specifies imposed maches, using a format described below.
// Validation is performed in RunMatch().
explicit ImposedEnsembleMatcher(const std::string& imposed_matches);
+ ImposedEnsembleMatcher(const ImposedEnsembleMatcher&) = delete;
+ const ImposedEnsembleMatcher& operator=(const ImposedEnsembleMatcher&) =
+ delete;
~ImposedEnsembleMatcher() override;
// EnsembleMatcher:
@@ -74,8 +76,6 @@ class ImposedEnsembleMatcher : public EnsembleMatcher {
private:
const std::string imposed_matches_;
-
- DISALLOW_COPY_AND_ASSIGN(ImposedEnsembleMatcher);
};
} // namespace zucchini
diff --git a/io_utils.h b/io_utils.h
index 56f7075..63eeec8 100644
--- a/io_utils.h
+++ b/io_utils.h
@@ -13,8 +13,6 @@
#include <sstream>
#include <string>
-#include "base/macros.h"
-
namespace zucchini {
// An std::ostream wrapper that that limits number of std::endl lines to output,
@@ -44,12 +42,12 @@ class LimitedOutputStream : public std::ostream {
public:
LimitedOutputStream(std::ostream& os, int limit);
+ LimitedOutputStream(const LimitedOutputStream&) = delete;
+ const LimitedOutputStream& operator=(const LimitedOutputStream&) = delete;
bool full() const { return buf_.full(); }
private:
StreamBuf buf_;
-
- DISALLOW_COPY_AND_ASSIGN(LimitedOutputStream);
};
// A class to render hexadecimal numbers for std::ostream with 0-padding. This
@@ -88,14 +86,14 @@ std::ostream& operator<<(std::ostream& os, const AsHex<N, T>& as_hex) {
class PrefixSep {
public:
explicit PrefixSep(const std::string& sep_str) : sep_str_(sep_str) {}
+ PrefixSep(const PrefixSep&) = delete;
+ const PrefixSep& operator=(const PrefixSep&) = delete;
friend std::ostream& operator<<(std::ostream& ostr, PrefixSep& obj);
private:
std::string sep_str_;
bool first_ = true;
-
- DISALLOW_COPY_AND_ASSIGN(PrefixSep);
};
// An input manipulator that dictates the expected next character in
@@ -103,6 +101,8 @@ class PrefixSep {
class EatChar {
public:
explicit EatChar(char ch) : ch_(ch) {}
+ EatChar(const EatChar&) = delete;
+ const EatChar& operator=(const EatChar&) = delete;
friend inline std::istream& operator>>(std::istream& istr,
const EatChar& obj) {
@@ -113,8 +113,6 @@ class EatChar {
private:
char ch_;
-
- DISALLOW_COPY_AND_ASSIGN(EatChar);
};
// An input manipulator that reads an unsigned integer from |std::istream|,
diff --git a/mapped_file.h b/mapped_file.h
index e8cd590..f15e09a 100644
--- a/mapped_file.h
+++ b/mapped_file.h
@@ -13,7 +13,6 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
namespace zucchini {
@@ -24,6 +23,8 @@ class MappedFileReader {
// Maps |file| to memory for reading. Also validates |file|. Errors are
// available via HasError() and error().
explicit MappedFileReader(base::File file);
+ MappedFileReader(const MappedFileReader&) = delete;
+ const MappedFileReader& operator=(const MappedFileReader&) = delete;
const uint8_t* data() const { return buffer_.data(); }
size_t length() const { return buffer_.length(); }
@@ -35,8 +36,6 @@ class MappedFileReader {
private:
std::string error_;
base::MemoryMappedFile buffer_;
-
- DISALLOW_COPY_AND_ASSIGN(MappedFileReader);
};
// A file writer wrapper. The target file is deleted on destruction unless
@@ -49,6 +48,8 @@ class MappedFileWriter {
MappedFileWriter(const base::FilePath& file_path,
base::File file,
size_t length);
+ MappedFileWriter(const MappedFileWriter&) = delete;
+ const MappedFileWriter& operator=(const MappedFileWriter&) = delete;
~MappedFileWriter();
uint8_t* data() { return buffer_.data(); }
@@ -74,8 +75,6 @@ class MappedFileWriter {
base::File file_handle_;
base::MemoryMappedFile buffer_;
OnCloseDeleteBehavior delete_behavior_;
-
- DISALLOW_COPY_AND_ASSIGN(MappedFileWriter);
};
} // namespace zucchini
diff --git a/patch_writer.h b/patch_writer.h
index 3d42173..26b7baf 100644
--- a/patch_writer.h
+++ b/patch_writer.h
@@ -13,7 +13,6 @@
#include <vector>
#include "base/check.h"
-#include "base/macros.h"
#include "components/zucchini/buffer_sink.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/image_utils.h"
@@ -237,6 +236,8 @@ class EnsemblePatchWriter {
public:
explicit EnsemblePatchWriter(const PatchHeader& header);
EnsemblePatchWriter(ConstBufferView old_image, ConstBufferView new_image);
+ EnsemblePatchWriter(const EnsemblePatchWriter&) = delete;
+ const EnsemblePatchWriter& operator=(const EnsemblePatchWriter&) = delete;
~EnsemblePatchWriter();
// Reserves space for |count| patch elements.
@@ -264,8 +265,6 @@ class EnsemblePatchWriter {
PatchHeader header_;
std::vector<PatchElementWriter> elements_;
offset_t current_dst_offset_ = 0;
-
- DISALLOW_COPY_AND_ASSIGN(EnsemblePatchWriter);
};
} // namespace zucchini
diff --git a/reference_set.cc b/reference_set.cc
index 14d4e54..82a9951 100644
--- a/reference_set.cc
+++ b/reference_set.cc
@@ -8,7 +8,6 @@
#include <iterator>
#include "base/check_op.h"
-#include "base/macros.h"
#include "components/zucchini/target_pool.h"
namespace zucchini {
diff --git a/suffix_array.h b/suffix_array.h
index cf9af7d..75b3a38 100644
--- a/suffix_array.h
+++ b/suffix_array.h
@@ -11,7 +11,6 @@
#include <vector>
#include "base/check.h"
-#include "base/macros.h"
namespace zucchini {
@@ -425,8 +424,9 @@ class InducedSuffixSort {
suffix_array);
}
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(Implementation);
+ Implementation() = delete;
+ Implementation(const Implementation&) = delete;
+ const Implementation& operator=(const Implementation&) = delete;
};
};
diff --git a/targets_affinity.h b/targets_affinity.h
index 3a154e7..dff1741 100644
--- a/targets_affinity.h
+++ b/targets_affinity.h
@@ -10,7 +10,6 @@
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/image_utils.h"
namespace zucchini {
@@ -22,6 +21,8 @@ class EquivalenceMap;
class TargetsAffinity {
public:
TargetsAffinity();
+ TargetsAffinity(const TargetsAffinity&) = delete;
+ const TargetsAffinity& operator=(const TargetsAffinity&) = delete;
~TargetsAffinity();
// Infers affinity between |old_targets| and |new_targets| using similarities
@@ -65,8 +66,6 @@ class TargetsAffinity {
// lookup, given |old_key| or |new_key|.
std::vector<Association> forward_association_;
std::vector<Association> backward_association_;
-
- DISALLOW_COPY_AND_ASSIGN(TargetsAffinity);
};
} // namespace zucchini
diff --git a/test_disassembler.h b/test_disassembler.h
index 427ed91..e434fc4 100644
--- a/test_disassembler.h
+++ b/test_disassembler.h
@@ -9,7 +9,6 @@
#include <string>
#include <vector>
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/disassembler.h"
#include "components/zucchini/image_utils.h"
@@ -28,6 +27,8 @@ class TestDisassembler : public Disassembler {
const std::vector<Reference>& refs2,
const ReferenceTypeTraits& traits3,
const std::vector<Reference>& refs3);
+ TestDisassembler(const TestDisassembler&) = delete;
+ const TestDisassembler& operator=(const TestDisassembler&) = delete;
~TestDisassembler() override;
// Disassembler:
@@ -69,8 +70,6 @@ class TestDisassembler : public Disassembler {
ReferenceTypeTraits traits_[3];
std::vector<Reference> refs_[3];
-
- DISALLOW_COPY_AND_ASSIGN(TestDisassembler);
};
} // namespace zucchini
diff --git a/zucchini_commands.cc b/zucchini_commands.cc
index 106b256..93929bd 100644
--- a/zucchini_commands.cc
+++ b/zucchini_commands.cc
@@ -16,7 +16,6 @@
#include "base/files/file_path.h"
#include "base/files/memory_mapped_file.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "components/zucchini/buffer_view.h"
#include "components/zucchini/crc32.h"
#include "components/zucchini/io_utils.h"