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

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 6 16:27:18 PDT 2024


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

None

>From b41b5b33ff97c6752284b9562023e35d7ce265e0 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                                 | 2 +-
 llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h | 4 ++--
 .../WebAssembly/Disassembler/WebAssemblyDisassembler.cpp      | 2 +-
 llvm/lib/Target/X86/ImmutableGraph.h                          | 4 ++--
 5 files changed, 8 insertions(+), 8 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..deedf64378a5bd 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -67,7 +67,7 @@ bool isTargetMD(const MDNode *ProfData, const char *Name, unsigned MinOps) {
 }
 
 template <typename T,
-          typename = typename std::enable_if<std::is_arithmetic_v<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..53e2d23c0dcd1f 100644
--- a/llvm/lib/Target/X86/ImmutableGraph.h
+++ b/llvm/lib/Target/X86/ImmutableGraph.h
@@ -295,8 +295,8 @@ 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,
+      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;



More information about the llvm-commits mailing list