[llvm] 3285251 - [Support] Make shouldReverseIterate constexpr (#156812)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 11:08:11 PDT 2025


Author: Kazu Hirata
Date: 2025-09-04T11:08:07-07:00
New Revision: 328525150193e69943d177c48ba4a71cd020d5ae

URL: https://github.com/llvm/llvm-project/commit/328525150193e69943d177c48ba4a71cd020d5ae
DIFF: https://github.com/llvm/llvm-project/commit/328525150193e69943d177c48ba4a71cd020d5ae.diff

LOG: [Support] Make shouldReverseIterate constexpr (#156812)

This patch makes shouldReverseIterate constexpr, allowing compile-time
evaluation at call sites.

Added: 
    

Modified: 
    llvm/include/llvm/Support/ReverseIteration.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/ReverseIteration.h b/llvm/include/llvm/Support/ReverseIteration.h
index 9e9411856369e..1a42ff3368dcb 100644
--- a/llvm/include/llvm/Support/ReverseIteration.h
+++ b/llvm/include/llvm/Support/ReverseIteration.h
@@ -6,8 +6,7 @@
 
 namespace llvm {
 
-template<class T = void *>
-bool shouldReverseIterate() {
+template <class T = void *> constexpr bool shouldReverseIterate() {
 #if LLVM_ENABLE_REVERSE_ITERATION
   return detail::IsPointerLike<T>::value;
 #else


        


More information about the llvm-commits mailing list