[llvm] [ADT][NFC] Constexpr-ify if in DenseMap::clear (PR #108243)

Marc Auberer via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 09:08:24 PDT 2024


https://github.com/marcauberer created https://github.com/llvm/llvm-project/pull/108243

Make if constexpr due to constexpr condition.

>From be9ef037142cccca938b6bf5b3b3d3133d545dc2 Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at sap.com>
Date: Wed, 11 Sep 2024 08:43:57 +0000
Subject: [PATCH] [ADT][NFC] Constexpr-ify if in DenseMap::clear

---
 llvm/include/llvm/ADT/DenseMap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index fb267cf5cee1c6..083d5c9388f7c8 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -120,7 +120,7 @@ class DenseMapBase : public DebugEpochBase {
     }
 
     const KeyT EmptyKey = getEmptyKey();
-    if (std::is_trivially_destructible<ValueT>::value) {
+    if constexpr (std::is_trivially_destructible_v<ValueT>) {
       // Use a simpler loop when values don't need destruction.
       for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P)
         P->getFirst() = EmptyKey;



More information about the llvm-commits mailing list