[Lldb-commits] [lldb] [lldb] Make SBFile::operator bool explicit (PR #215819)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 12 08:05:52 PDT 2026


https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/215819

Every other SB class in the API declares `explicit operator bool()`. SBFile was the only one with an implicit conversion, which in general is not something we want.

>From 1ebf4c89a93e824bcd1592d374878bf717920495 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Wed, 12 Aug 2026 13:50:08 +0100
Subject: [PATCH] [lldb] Make SBFile::operator bool explicit

Every other SB class in the API declares `explicit operator bool()`.
SBFile was the only one with an implicit conversion, which in general
is not something we want.
---
 lldb/include/lldb/API/SBFile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/include/lldb/API/SBFile.h b/lldb/include/lldb/API/SBFile.h
index 8cf4fe1b405fa..c73a134e34d22 100644
--- a/lldb/include/lldb/API/SBFile.h
+++ b/lldb/include/lldb/API/SBFile.h
@@ -43,7 +43,7 @@ class LLDB_API SBFile {
   bool IsValid() const;
   SBError Close();
 
-  operator bool() const;
+  explicit operator bool() const;
 #ifndef SWIG
   bool operator!() const;
 #endif



More information about the lldb-commits mailing list