Skip to content

Commit

Permalink
Modernize types and constraints (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
AreaZR committed Jul 7, 2024
1 parent 75bc20f commit 9368eb2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/IR/AttributeImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class AttributeImpl : public FoldingSetNode {
}
};

static_assert(std::is_trivially_destructible<AttributeImpl>::value,
static_assert(std::is_trivially_destructible_v<AttributeImpl>,
"AttributeImpl should be trivially destructible");

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -412,7 +412,7 @@ class AttributeListImpl final
void dump() const;
};

static_assert(std::is_trivially_destructible<AttributeListImpl>::value,
static_assert(std::is_trivially_destructible_v<AttributeListImpl>,
"AttributeListImpl should be trivially destructible");

} // end namespace llvm
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/IR/ProfDataUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ bool isTargetMD(const MDNode *ProfData, const char *Name, unsigned MinOps) {
return ProfDataName->getString() == Name;
}

template <typename T,
typename = typename std::enable_if<std::is_arithmetic_v<T>>>
template <typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
static void extractFromBranchWeightMD(const MDNode *ProfileData,
SmallVectorImpl<T> &Weights) {
assert(isBranchWeightMD(ProfileData) && "wrong metadata");
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ static inline bool isSVECpyImm(int64_t Imm) {
/// Returns true if Imm is valid for ADD/SUB.
template <typename T>
static inline bool isSVEAddSubImm(int64_t Imm) {
bool IsInt8t = std::is_same<int8_t, std::make_signed_t<T>>::value ||
std::is_same<int8_t, T>::value;
bool IsInt8t = std::is_same_v<int8_t, std::make_signed_t<T>> ||
std::is_same_v<int8_t, T>;
return uint8_t(Imm) == Imm || (!IsInt8t && uint16_t(Imm & ~0xff) == Imm);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
T Val =
support::endian::read<T, llvm::endianness::little>(Bytes.data() + Size);
Size += sizeof(T);
if (std::is_floating_point<T>::value) {
if (std::is_floating_point_v<T>) {
MI.addOperand(
MCOperand::createDFPImm(bit_cast<uint64_t>(static_cast<double>(Val))));
} else {
Expand Down
9 changes: 4 additions & 5 deletions llvm/lib/Target/X86/ImmutableGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,10 @@ template <typename NodeValueT, typename EdgeValueT> class ImmutableGraph {
template <typename GraphT> class ImmutableGraphBuilder {
using node_value_type = typename GraphT::node_value_type;
using edge_value_type = typename GraphT::edge_value_type;
static_assert(
std::is_base_of<ImmutableGraph<node_value_type, edge_value_type>,
GraphT>::value,
"Template argument to ImmutableGraphBuilder must derive from "
"ImmutableGraph<>");
static_assert(std::is_base_of_v<
ImmutableGraph<node_value_type, edge_value_type>, GraphT>,
"Template argument to ImmutableGraphBuilder must derive from "
"ImmutableGraph<>");
using size_type = typename GraphT::size_type;
using NodeSet = typename GraphT::NodeSet;
using Node = typename GraphT::Node;
Expand Down

0 comments on commit 9368eb2

Please sign in to comment.