[ADT] Use default member initialization (NFC)

Identified with modernize-use-default-member-init.
This commit is contained in:
Kazu Hirata
2022-07-23 10:50:26 -07:00
parent a9782fead3
commit 71cdb8c6f1
6 changed files with 18 additions and 18 deletions

View File

@@ -147,7 +147,7 @@ public:
APInt(unsigned numBits, StringRef str, uint8_t radix);
/// Default constructor that creates an APInt with a 1-bit zero value.
explicit APInt() : BitWidth(1) { U.VAL = 0; }
explicit APInt() { U.VAL = 0; }
/// Copy Constructor.
APInt(const APInt &that) : BitWidth(that.BitWidth) {
@@ -1824,7 +1824,7 @@ private:
uint64_t *pVal; ///< Used to store the >64 bits integer value.
} U;
unsigned BitWidth; ///< The number of bits in this APInt.
unsigned BitWidth = 1; ///< The number of bits in this APInt.
friend struct DenseMapInfo<APInt, void>;
friend class APSInt;

View File

@@ -21,11 +21,11 @@ namespace llvm {
/// An arbitrary precision integer that knows its signedness.
class LLVM_NODISCARD APSInt : public APInt {
bool IsUnsigned;
bool IsUnsigned = false;
public:
/// Default constructor that creates an uninitialized APInt.
explicit APSInt() : IsUnsigned(false) {}
explicit APSInt() = default;
/// Create an APSInt with the specified width, default to unsigned.
explicit APSInt(uint32_t BitWidth, bool isUnsigned = true)

View File

@@ -83,7 +83,7 @@ class BitVector {
using Storage = SmallVector<BitWord>;
Storage Bits; // Actual bits.
unsigned Size; // Size of bitvector in bits.
unsigned Size = 0; // Size of bitvector in bits.
public:
using size_type = unsigned;
@@ -135,7 +135,7 @@ public:
}
/// BitVector default ctor - Creates an empty bitvector.
BitVector() : Size(0) {}
BitVector() = default;
/// BitVector ctor - Creates a bitvector of specified number of bits. All
/// bits are initialized to the specified value.

View File

@@ -56,11 +56,11 @@ public:
/// make an iterator-invalidating modification.
///
class HandleBase {
const uint64_t *EpochAddress;
uint64_t EpochAtCreation;
const uint64_t *EpochAddress = nullptr;
uint64_t EpochAtCreation = UINT64_MAX;
public:
HandleBase() : EpochAddress(nullptr), EpochAtCreation(UINT64_MAX) {}
HandleBase() = default;
explicit HandleBase(const DebugEpochBase *Parent)
: EpochAddress(&Parent->Epoch), EpochAtCreation(Parent->Epoch) {}

View File

@@ -35,11 +35,11 @@ class IntEqClasses {
/// NumClasses - The number of equivalence classes when compressed, or 0 when
/// uncompressed.
unsigned NumClasses;
unsigned NumClasses = 0;
public:
/// IntEqClasses - Create an equivalence class mapping for 0 .. N-1.
IntEqClasses(unsigned N = 0) : NumClasses(0) { grow(N); }
IntEqClasses(unsigned N = 0) { grow(N); }
/// grow - Increase capacity to hold 0 .. N-1, putting new integers in unique
/// equivalence classes.

View File

@@ -283,22 +283,22 @@ private:
std::string Data;
/// The parsed arch type.
ArchType Arch;
ArchType Arch{};
/// The parsed subarchitecture type.
SubArchType SubArch;
SubArchType SubArch{};
/// The parsed vendor type.
VendorType Vendor;
VendorType Vendor{};
/// The parsed OS type.
OSType OS;
OSType OS{};
/// The parsed Environment type.
EnvironmentType Environment;
EnvironmentType Environment{};
/// The object format type.
ObjectFormatType ObjectFormat;
ObjectFormatType ObjectFormat{};
public:
/// @name Constructors
@@ -306,7 +306,7 @@ public:
/// Default constructor is the same as an empty string and leaves all
/// triple fields unknown.
Triple() : Arch(), SubArch(), Vendor(), OS(), Environment(), ObjectFormat() {}
Triple() = default;
explicit Triple(const Twine &Str);
Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);