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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Marc Auberer (marcauberer)

<details>
<summary>Changes</summary>

Make if constexpr due to constexpr condition.

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


1 Files Affected:

- (modified) llvm/include/llvm/ADT/DenseMap.h (+1-1) 


``````````diff
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;

``````````

</details>


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


More information about the llvm-commits mailing list