[llvm] [ADT] Mark BitVector::find_prev_unset const (NFC) (PR #156272)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 31 20:56:13 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/156272

find_prev_unset calls find_last_unset_in, a const method, but
find_prev_unset itself isn't marked const.


>From fa814f4a00f3bb02659ad301c3898a7fbf1e7ff5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 30 Aug 2025 16:16:08 -0700
Subject: [PATCH] [ADT] Mark BitVector::find_prev_unset const (NFC)

find_prev_unset calls find_last_unset_in, a const method, but
find_prev_unset itself isn't marked const.
---
 llvm/include/llvm/ADT/BitVector.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h
index 70de4c239c1c7..1fbce1a95fb76 100644
--- a/llvm/include/llvm/ADT/BitVector.h
+++ b/llvm/include/llvm/ADT/BitVector.h
@@ -327,7 +327,7 @@ class BitVector {
 
   /// find_prev_unset - Returns the index of the first unset bit that precedes
   /// the bit at \p PriorTo.  Returns -1 if all previous bits are set.
-  int find_prev_unset(unsigned PriorTo) {
+  int find_prev_unset(unsigned PriorTo) const {
     return find_last_unset_in(0, PriorTo);
   }
 



More information about the llvm-commits mailing list