Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize types and constraints (NFC) #97923

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AtariDreams
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 6, 2024

@llvm/pr-subscribers-backend-webassembly
@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-aarch64

Author: AtariDreams (AtariDreams)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/97923.diff

5 Files Affected:

  • (modified) llvm/lib/IR/AttributeImpl.h (+2-2)
  • (modified) llvm/lib/IR/ProfDataUtils.cpp (+1-1)
  • (modified) llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h (+2-2)
  • (modified) llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp (+1-1)
  • (modified) llvm/lib/Target/X86/ImmutableGraph.h (+2-2)
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index b9441729b48c6..5ba24b2e09568 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 992ce34e00034..deedf64378a5b 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 03cbd272757e7..33f6659f225aa 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 3585b5f4a5c9a..ab1b420c46215 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 b867fa578fc0e..53e2d23c0dcd1 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;

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 6, 2024

@llvm/pr-subscribers-backend-x86

Author: AtariDreams (AtariDreams)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/97923.diff

5 Files Affected:

  • (modified) llvm/lib/IR/AttributeImpl.h (+2-2)
  • (modified) llvm/lib/IR/ProfDataUtils.cpp (+1-1)
  • (modified) llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h (+2-2)
  • (modified) llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp (+1-1)
  • (modified) llvm/lib/Target/X86/ImmutableGraph.h (+2-2)
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index b9441729b48c6..5ba24b2e09568 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 992ce34e00034..deedf64378a5b 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 03cbd272757e7..33f6659f225aa 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 3585b5f4a5c9a..ab1b420c46215 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 b867fa578fc0e..53e2d23c0dcd1 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;

Copy link

github-actions bot commented Jul 6, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants