forked from OSchip/llvm-project
Make more constructors constexpr or use =default.
This lets the compiler reason about the type more easily. No functionality change intended. llvm-svn: 315180
This commit is contained in:
parent
1f83777bd3
commit
3f8c1189c7
|
@ -294,7 +294,7 @@ namespace llvm {
|
|||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
|
||||
/// Construct an empty MutableArrayRef.
|
||||
/*implicit*/ MutableArrayRef() : ArrayRef<T>() {}
|
||||
/*implicit*/ MutableArrayRef() = default;
|
||||
|
||||
/// Construct an empty MutableArrayRef from None.
|
||||
/*implicit*/ MutableArrayRef(NoneType) : ArrayRef<T>() {}
|
||||
|
|
|
@ -47,7 +47,7 @@ class PointerIntPair {
|
|||
intptr_t Value;
|
||||
|
||||
public:
|
||||
PointerIntPair() : Value(0) {}
|
||||
constexpr PointerIntPair() : Value(0) {}
|
||||
PointerIntPair(PointerTy PtrVal, IntType IntVal) {
|
||||
setPointerAndInt(PtrVal, IntVal);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ template <typename TagT, typename... MemberTs> class PointerSumType {
|
|||
typedef detail::PointerSumTypeHelper<TagT, MemberTs...> HelperT;
|
||||
|
||||
public:
|
||||
PointerSumType() : Value(0) {}
|
||||
constexpr PointerSumType() : Value(0) {}
|
||||
|
||||
/// A typed constructor for a specific tagged member of the sum type.
|
||||
template <TagT N>
|
||||
|
|
|
@ -139,7 +139,7 @@ class raw_ostream;
|
|||
};
|
||||
|
||||
/// Construct an invalid index.
|
||||
SlotIndex() : lie(nullptr, 0) {}
|
||||
SlotIndex() = default;
|
||||
|
||||
// Construct a new slot index from the given one, and set the slot.
|
||||
SlotIndex(const SlotIndex &li, Slot s) : lie(li.listEntry(), unsigned(s)) {
|
||||
|
|
|
@ -62,7 +62,7 @@ class CallSiteBase {
|
|||
protected:
|
||||
PointerIntPair<InstrTy*, 1, bool> I;
|
||||
|
||||
CallSiteBase() : I(nullptr, false) {}
|
||||
CallSiteBase() = default;
|
||||
CallSiteBase(CallTy *CI) : I(CI, true) { assert(CI); }
|
||||
CallSiteBase(InvokeTy *II) : I(II, false) { assert(II); }
|
||||
explicit CallSiteBase(ValTy *II) { *this = get(II); }
|
||||
|
|
|
@ -38,11 +38,12 @@ class raw_ostream;
|
|||
/// Note that this class must remain a simple POD value class, because we need
|
||||
/// it to live in unions etc.
|
||||
class MCValue {
|
||||
const MCSymbolRefExpr *SymA, *SymB;
|
||||
int64_t Cst;
|
||||
uint32_t RefKind;
|
||||
const MCSymbolRefExpr *SymA = nullptr, *SymB = nullptr;
|
||||
int64_t Cst = 0;
|
||||
uint32_t RefKind = 0;
|
||||
|
||||
public:
|
||||
MCValue() : SymA(nullptr), SymB(nullptr), Cst(0), RefKind(0) {}
|
||||
MCValue() = default;
|
||||
int64_t getConstant() const { return Cst; }
|
||||
const MCSymbolRefExpr *getSymA() const { return SymA; }
|
||||
const MCSymbolRefExpr *getSymB() const { return SymB; }
|
||||
|
|
|
@ -504,13 +504,13 @@ private:
|
|||
static_assert(Width <= 64, "invalid integer width for digits");
|
||||
|
||||
private:
|
||||
DigitsType Digits;
|
||||
int16_t Scale;
|
||||
DigitsType Digits = 0;
|
||||
int16_t Scale = 0;
|
||||
|
||||
public:
|
||||
ScaledNumber() : Digits(0), Scale(0) {}
|
||||
ScaledNumber() = default;
|
||||
|
||||
ScaledNumber(DigitsType Digits, int16_t Scale)
|
||||
constexpr ScaledNumber(DigitsType Digits, int16_t Scale)
|
||||
: Digits(Digits), Scale(Scale) {}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue