[llvm] Modernize types and constraints (NFC) (PR #97923)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 6 17:03:56 PDT 2024


https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/97923

>From 9368eb216b27fbd659779fbc2903e51f883b64f7 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Sat, 6 Jul 2024 19:26:55 -0400
Subject: [PATCH] Modernize types and constraints (NFC)

---
 llvm/lib/IR/AttributeImpl.h                              | 4 ++--
 llvm/lib/IR/ProfDataUtils.cpp                            | 3 +--
 .../Target/AArch64/MCTargetDesc/AArch64AddressingModes.h | 4 ++--
 .../WebAssembly/Disassembler/WebAssemblyDisassembler.cpp | 2 +-
 llvm/lib/Target/X86/ImmutableGraph.h                     | 9 ++++-----
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index b9441729b48c69..5ba24b2e095688 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -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");
 
 //===----------------------------------------------------------------------===//
@@ -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
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 992ce34e000343..7acd1d4f5c4246 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -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");
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
index 03cbd272757e78..33f6659f225aaf 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h
@@ -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);
 }
 
diff --git a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
index 3585b5f4a5c9ad..ab1b420c46215b 100644
--- a/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
+++ b/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
@@ -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 {
diff --git a/llvm/lib/Target/X86/ImmutableGraph.h b/llvm/lib/Target/X86/ImmutableGraph.h
index b867fa578fc0ed..3c623c5a573de2 100644
--- a/llvm/lib/Target/X86/ImmutableGraph.h
+++ b/llvm/lib/Target/X86/ImmutableGraph.h
@@ -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;



More information about the llvm-commits mailing list