Index: include/lldb/API/SBAddress.h =================================================================== --- include/lldb/API/SBAddress.h +++ include/lldb/API/SBAddress.h @@ -31,6 +31,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); addr_t GetFileAddress() const; Index: include/lldb/API/SBBlock.h =================================================================== --- include/lldb/API/SBBlock.h +++ include/lldb/API/SBBlock.h @@ -30,6 +30,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetInlinedName() const; lldb::SBFileSpec GetInlinedCallSiteFile() const; Index: include/lldb/API/SBBreakpoint.h =================================================================== --- include/lldb/API/SBBreakpoint.h +++ include/lldb/API/SBBreakpoint.h @@ -38,6 +38,8 @@ bool IsValid() const; + explicit operator bool() const; + void ClearAllBreakpointSites(); lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr); Index: include/lldb/API/SBBreakpointLocation.h =================================================================== --- include/lldb/API/SBBreakpointLocation.h +++ include/lldb/API/SBBreakpointLocation.h @@ -29,6 +29,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBAddress GetAddress(); lldb::addr_t GetLoadAddress(); Index: include/lldb/API/SBBreakpointName.h =================================================================== --- include/lldb/API/SBBreakpointName.h +++ include/lldb/API/SBBreakpointName.h @@ -40,7 +40,9 @@ bool operator!=(const lldb::SBBreakpointName &rhs); bool IsValid() const; - + + explicit operator bool() const; + const char *GetName() const; void SetEnabled(bool enable); Index: include/lldb/API/SBBroadcaster.h =================================================================== --- include/lldb/API/SBBroadcaster.h +++ include/lldb/API/SBBroadcaster.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); void BroadcastEventByType(uint32_t event_type, bool unique = false); Index: include/lldb/API/SBCommandInterpreter.h =================================================================== --- include/lldb/API/SBCommandInterpreter.h +++ include/lldb/API/SBCommandInterpreter.h @@ -89,6 +89,8 @@ bool IsValid() const; + explicit operator bool() const; + bool CommandExists(const char *cmd); bool AliasExists(const char *cmd); @@ -274,6 +276,8 @@ bool IsValid(); + explicit operator bool() const; + const char *GetName(); const char *GetHelp(); Index: include/lldb/API/SBCommandReturnObject.h =================================================================== --- include/lldb/API/SBCommandReturnObject.h +++ include/lldb/API/SBCommandReturnObject.h @@ -34,6 +34,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetOutput(); const char *GetError(); Index: include/lldb/API/SBCommunication.h =================================================================== --- include/lldb/API/SBCommunication.h +++ include/lldb/API/SBCommunication.h @@ -39,6 +39,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBBroadcaster GetBroadcaster(); static const char *GetBroadcasterClass(); Index: include/lldb/API/SBCompileUnit.h =================================================================== --- include/lldb/API/SBCompileUnit.h +++ include/lldb/API/SBCompileUnit.h @@ -26,6 +26,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBFileSpec GetFileSpec() const; uint32_t GetNumLineEntries() const; Index: include/lldb/API/SBData.h =================================================================== --- include/lldb/API/SBData.h +++ include/lldb/API/SBData.h @@ -31,6 +31,8 @@ bool IsValid(); + explicit operator bool() const; + size_t GetByteSize(); lldb::ByteOrder GetByteOrder(); Index: include/lldb/API/SBDebugger.h =================================================================== --- include/lldb/API/SBDebugger.h +++ include/lldb/API/SBDebugger.h @@ -64,6 +64,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); void SetAsync(bool b); Index: include/lldb/API/SBDeclaration.h =================================================================== --- include/lldb/API/SBDeclaration.h +++ include/lldb/API/SBDeclaration.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBFileSpec GetFileSpec() const; uint32_t GetLine() const; Index: include/lldb/API/SBError.h =================================================================== --- include/lldb/API/SBError.h +++ include/lldb/API/SBError.h @@ -48,6 +48,8 @@ bool IsValid() const; + explicit operator bool() const; + bool GetDescription(lldb::SBStream &description); protected: Index: include/lldb/API/SBEvent.h =================================================================== --- include/lldb/API/SBEvent.h +++ include/lldb/API/SBEvent.h @@ -37,6 +37,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetDataFlavor(); uint32_t GetType() const; Index: include/lldb/API/SBFileSpec.h =================================================================== --- include/lldb/API/SBFileSpec.h +++ include/lldb/API/SBFileSpec.h @@ -30,6 +30,8 @@ bool IsValid() const; + explicit operator bool() const; + bool Exists() const; bool ResolveExecutableLocation(); Index: include/lldb/API/SBFrame.h =================================================================== --- include/lldb/API/SBFrame.h +++ include/lldb/API/SBFrame.h @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + uint32_t GetFrameID() const; lldb::addr_t GetCFA() const; Index: include/lldb/API/SBFunction.h =================================================================== --- include/lldb/API/SBFunction.h +++ include/lldb/API/SBFunction.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName() const; const char *GetDisplayName() const; Index: include/lldb/API/SBInstruction.h =================================================================== --- include/lldb/API/SBInstruction.h +++ include/lldb/API/SBInstruction.h @@ -33,6 +33,8 @@ bool IsValid(); + explicit operator bool() const; + SBAddress GetAddress(); const char *GetMnemonic(lldb::SBTarget target); Index: include/lldb/API/SBInstructionList.h =================================================================== --- include/lldb/API/SBInstructionList.h +++ include/lldb/API/SBInstructionList.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + size_t GetSize(); lldb::SBInstruction GetInstructionAtIndex(uint32_t idx); Index: include/lldb/API/SBLineEntry.h =================================================================== --- include/lldb/API/SBLineEntry.h +++ include/lldb/API/SBLineEntry.h @@ -31,6 +31,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBFileSpec GetFileSpec() const; uint32_t GetLine() const; Index: include/lldb/API/SBListener.h =================================================================== --- include/lldb/API/SBListener.h +++ include/lldb/API/SBListener.h @@ -31,6 +31,8 @@ bool IsValid() const; + explicit operator bool() const; + uint32_t StartListeningForEventClass(SBDebugger &debugger, const char *broadcaster_class, uint32_t event_mask); Index: include/lldb/API/SBModule.h =================================================================== --- include/lldb/API/SBModule.h +++ include/lldb/API/SBModule.h @@ -33,6 +33,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); //------------------------------------------------------------------ Index: include/lldb/API/SBModuleSpec.h =================================================================== --- include/lldb/API/SBModuleSpec.h +++ include/lldb/API/SBModuleSpec.h @@ -26,6 +26,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); //------------------------------------------------------------------ Index: include/lldb/API/SBPlatform.h =================================================================== --- include/lldb/API/SBPlatform.h +++ include/lldb/API/SBPlatform.h @@ -93,6 +93,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); const char *GetWorkingDirectory(); Index: include/lldb/API/SBProcess.h =================================================================== --- include/lldb/API/SBProcess.h +++ include/lldb/API/SBProcess.h @@ -53,6 +53,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBTarget GetTarget() const; lldb::ByteOrder GetByteOrder() const; Index: include/lldb/API/SBProcessInfo.h =================================================================== --- include/lldb/API/SBProcessInfo.h +++ include/lldb/API/SBProcessInfo.h @@ -24,6 +24,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName(); SBFileSpec GetExecutableFile(); Index: include/lldb/API/SBQueue.h =================================================================== --- include/lldb/API/SBQueue.h +++ include/lldb/API/SBQueue.h @@ -30,6 +30,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); lldb::SBProcess GetProcess(); Index: include/lldb/API/SBQueueItem.h =================================================================== --- include/lldb/API/SBQueueItem.h +++ include/lldb/API/SBQueueItem.h @@ -24,6 +24,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); lldb::QueueItemKind GetKind() const; Index: include/lldb/API/SBSection.h =================================================================== --- include/lldb/API/SBSection.h +++ include/lldb/API/SBSection.h @@ -26,6 +26,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName(); lldb::SBSection GetParent(); Index: include/lldb/API/SBStream.h =================================================================== --- include/lldb/API/SBStream.h +++ include/lldb/API/SBStream.h @@ -25,6 +25,8 @@ bool IsValid() const; + explicit operator bool() const; + // If this stream is not redirected to a file, it will maintain a local cache // for the stream data which can be accessed using this accessor. const char *GetData(); Index: include/lldb/API/SBStringList.h =================================================================== --- include/lldb/API/SBStringList.h +++ include/lldb/API/SBStringList.h @@ -25,6 +25,8 @@ bool IsValid() const; + explicit operator bool() const; + void AppendString(const char *str); void AppendList(const char **strv, int strc); Index: include/lldb/API/SBStructuredData.h =================================================================== --- include/lldb/API/SBStructuredData.h +++ include/lldb/API/SBStructuredData.h @@ -30,6 +30,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBError SetFromJSON(lldb::SBStream &stream); void Clear(); Index: include/lldb/API/SBSymbol.h =================================================================== --- include/lldb/API/SBSymbol.h +++ include/lldb/API/SBSymbol.h @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName() const; const char *GetDisplayName() const; Index: include/lldb/API/SBSymbolContext.h =================================================================== --- include/lldb/API/SBSymbolContext.h +++ include/lldb/API/SBSymbolContext.h @@ -31,6 +31,8 @@ bool IsValid() const; + explicit operator bool() const; + const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs); lldb::SBModule GetModule(); Index: include/lldb/API/SBSymbolContextList.h =================================================================== --- include/lldb/API/SBSymbolContextList.h +++ include/lldb/API/SBSymbolContextList.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + uint32_t GetSize() const; lldb::SBSymbolContext GetContextAtIndex(uint32_t idx); Index: include/lldb/API/SBTarget.h =================================================================== --- include/lldb/API/SBTarget.h +++ include/lldb/API/SBTarget.h @@ -57,6 +57,8 @@ bool IsValid() const; + explicit operator bool() const; + static bool EventIsTargetEvent(const lldb::SBEvent &event); static lldb::SBTarget GetTargetFromEvent(const lldb::SBEvent &event); Index: include/lldb/API/SBThread.h =================================================================== --- include/lldb/API/SBThread.h +++ include/lldb/API/SBThread.h @@ -41,6 +41,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); lldb::StopReason GetStopReason(); Index: include/lldb/API/SBThreadCollection.h =================================================================== --- include/lldb/API/SBThreadCollection.h +++ include/lldb/API/SBThreadCollection.h @@ -25,6 +25,8 @@ bool IsValid() const; + explicit operator bool() const; + size_t GetSize(); lldb::SBThread GetThreadAtIndex(size_t idx); Index: include/lldb/API/SBThreadPlan.h =================================================================== --- include/lldb/API/SBThreadPlan.h +++ include/lldb/API/SBThreadPlan.h @@ -32,6 +32,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); lldb::StopReason GetStopReason(); Index: include/lldb/API/SBTrace.h =================================================================== --- include/lldb/API/SBTrace.h +++ include/lldb/API/SBTrace.h @@ -102,6 +102,8 @@ bool IsValid(); + explicit operator bool() const; + protected: typedef std::shared_ptr TraceImplSP; Index: include/lldb/API/SBTraceOptions.h =================================================================== --- include/lldb/API/SBTraceOptions.h +++ include/lldb/API/SBTraceOptions.h @@ -46,6 +46,8 @@ bool IsValid(); + explicit operator bool() const; + protected: friend class SBProcess; friend class SBTrace; Index: include/lldb/API/SBType.h =================================================================== --- include/lldb/API/SBType.h +++ include/lldb/API/SBType.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName(); lldb::SBType GetType(); @@ -66,6 +68,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName(); const char *GetDemangledName(); @@ -107,6 +111,8 @@ bool IsValid() const; + explicit operator bool() const; + uint64_t GetByteSize(); bool IsPointerType(); @@ -237,6 +243,8 @@ bool IsValid(); + explicit operator bool() const; + void Append(lldb::SBType type); lldb::SBType GetTypeAtIndex(uint32_t index); Index: include/lldb/API/SBTypeCategory.h =================================================================== --- include/lldb/API/SBTypeCategory.h +++ include/lldb/API/SBTypeCategory.h @@ -24,6 +24,8 @@ bool IsValid() const; + explicit operator bool() const; + bool GetEnabled(); void SetEnabled(bool); Index: include/lldb/API/SBTypeEnumMember.h =================================================================== --- include/lldb/API/SBTypeEnumMember.h +++ include/lldb/API/SBTypeEnumMember.h @@ -26,6 +26,8 @@ bool IsValid() const; + explicit operator bool() const; + int64_t GetValueAsSigned(); uint64_t GetValueAsUnsigned(); @@ -64,6 +66,8 @@ bool IsValid(); + explicit operator bool() const; + void Append(SBTypeEnumMember entry); SBTypeEnumMember GetTypeEnumMemberAtIndex(uint32_t index); Index: include/lldb/API/SBTypeFilter.h =================================================================== --- include/lldb/API/SBTypeFilter.h +++ include/lldb/API/SBTypeFilter.h @@ -26,6 +26,8 @@ bool IsValid() const; + explicit operator bool() const; + uint32_t GetNumberOfExpressionPaths(); const char *GetExpressionPathAtIndex(uint32_t i); Index: include/lldb/API/SBTypeFormat.h =================================================================== --- include/lldb/API/SBTypeFormat.h +++ include/lldb/API/SBTypeFormat.h @@ -30,6 +30,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::Format GetFormat(); const char *GetTypeName(); Index: include/lldb/API/SBTypeNameSpecifier.h =================================================================== --- include/lldb/API/SBTypeNameSpecifier.h +++ include/lldb/API/SBTypeNameSpecifier.h @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetName(); SBType GetType(); Index: include/lldb/API/SBTypeSummary.h =================================================================== --- include/lldb/API/SBTypeSummary.h +++ include/lldb/API/SBTypeSummary.h @@ -25,6 +25,8 @@ bool IsValid(); + explicit operator bool() const; + lldb::LanguageType GetLanguage(); lldb::TypeSummaryCapping GetCapping(); @@ -81,6 +83,8 @@ bool IsValid() const; + explicit operator bool() const; + bool IsFunctionCode(); bool IsFunctionName(); Index: include/lldb/API/SBTypeSynthetic.h =================================================================== --- include/lldb/API/SBTypeSynthetic.h +++ include/lldb/API/SBTypeSynthetic.h @@ -34,6 +34,8 @@ bool IsValid() const; + explicit operator bool() const; + bool IsClassCode(); bool IsClassName(); Index: include/lldb/API/SBUnixSignals.h =================================================================== --- include/lldb/API/SBUnixSignals.h +++ include/lldb/API/SBUnixSignals.h @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + const char *GetSignalAsCString(int32_t signo) const; int32_t GetSignalNumberFromName(const char *name) const; Index: include/lldb/API/SBValue.h =================================================================== --- include/lldb/API/SBValue.h +++ include/lldb/API/SBValue.h @@ -30,6 +30,8 @@ bool IsValid(); + explicit operator bool() const; + void Clear(); SBError GetError(); Index: include/lldb/API/SBValueList.h =================================================================== --- include/lldb/API/SBValueList.h +++ include/lldb/API/SBValueList.h @@ -25,6 +25,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); void Append(const lldb::SBValue &val_obj); Index: include/lldb/API/SBVariablesOptions.h =================================================================== --- include/lldb/API/SBVariablesOptions.h +++ include/lldb/API/SBVariablesOptions.h @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + bool GetIncludeArguments() const; void SetIncludeArguments(bool); Index: include/lldb/API/SBWatchpoint.h =================================================================== --- include/lldb/API/SBWatchpoint.h +++ include/lldb/API/SBWatchpoint.h @@ -27,6 +27,8 @@ bool IsValid() const; + explicit operator bool() const; + SBError GetError(); watch_id_t GetID(); Index: scripts/Python/modify-python-lldb.py =================================================================== --- scripts/Python/modify-python-lldb.py +++ scripts/Python/modify-python-lldb.py @@ -332,11 +332,6 @@ if one_liner_docstring_pattern.match(line): line = char_to_str_xform(line) - # Look for 'def IsValid(*args):', and once located, add implementation - # of truth value testing for this object by delegation. - if isvalid_pattern.search(line): - new_content.add_line(nonzero_def) - # Pass the original line of content to new_content. new_content.add_line(line) Index: scripts/interface/SBAddress.i =================================================================== --- scripts/interface/SBAddress.i +++ scripts/interface/SBAddress.i @@ -62,6 +62,8 @@ bool IsValid () const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBBlock.i =================================================================== --- scripts/interface/SBBlock.i +++ scripts/interface/SBBlock.i @@ -30,6 +30,8 @@ bool IsValid () const; + explicit operator bool() const; + %feature("docstring", " Get the function name if this block represents an inlined function; otherwise, return None. Index: scripts/interface/SBBreakpoint.i =================================================================== --- scripts/interface/SBBreakpoint.i +++ scripts/interface/SBBreakpoint.i @@ -91,6 +91,8 @@ bool IsValid() const; + explicit operator bool() const; + void ClearAllBreakpointSites (); Index: scripts/interface/SBBreakpointLocation.i =================================================================== --- scripts/interface/SBBreakpointLocation.i +++ scripts/interface/SBBreakpointLocation.i @@ -34,6 +34,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBAddress GetAddress(); Index: scripts/interface/SBBreakpointName.i =================================================================== --- scripts/interface/SBBreakpointName.i +++ scripts/interface/SBBreakpointName.i @@ -43,6 +43,8 @@ bool operator!=(const lldb::SBBreakpointName &rhs); bool IsValid() const; + + explicit operator bool() const; const char *GetName() const; Index: scripts/interface/SBBroadcaster.i =================================================================== --- scripts/interface/SBBroadcaster.i +++ scripts/interface/SBBroadcaster.i @@ -33,6 +33,8 @@ bool IsValid () const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBCommandInterpreter.i =================================================================== --- scripts/interface/SBCommandInterpreter.i +++ scripts/interface/SBCommandInterpreter.i @@ -145,6 +145,8 @@ bool IsValid() const; + explicit operator bool() const; + const char * GetIOHandlerControlSequence(char ch); Index: scripts/interface/SBCommandReturnObject.i =================================================================== --- scripts/interface/SBCommandReturnObject.i +++ scripts/interface/SBCommandReturnObject.i @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + const char * GetOutput (); Index: scripts/interface/SBCommunication.i =================================================================== --- scripts/interface/SBCommunication.i +++ scripts/interface/SBCommunication.i @@ -30,6 +30,8 @@ bool IsValid () const; + explicit operator bool() const; + lldb::SBBroadcaster GetBroadcaster (); Index: scripts/interface/SBCompileUnit.i =================================================================== --- scripts/interface/SBCompileUnit.i +++ scripts/interface/SBCompileUnit.i @@ -56,6 +56,8 @@ bool IsValid () const; + explicit operator bool() const; + lldb::SBFileSpec GetFileSpec () const; Index: scripts/interface/SBData.i =================================================================== --- scripts/interface/SBData.i +++ scripts/interface/SBData.i @@ -31,6 +31,8 @@ bool IsValid(); + explicit operator bool() const; + size_t GetByteSize (); Index: scripts/interface/SBDebugger.i =================================================================== --- scripts/interface/SBDebugger.i +++ scripts/interface/SBDebugger.i @@ -152,6 +152,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBDeclaration.i =================================================================== --- scripts/interface/SBDeclaration.i +++ scripts/interface/SBDeclaration.i @@ -23,6 +23,8 @@ bool IsValid () const; + + explicit operator bool() const; lldb::SBFileSpec GetFileSpec () const; Index: scripts/interface/SBError.i =================================================================== --- scripts/interface/SBError.i +++ scripts/interface/SBError.i @@ -101,6 +101,8 @@ bool IsValid () const; + explicit operator bool() const; + bool GetDescription (lldb::SBStream &description); Index: scripts/interface/SBEvent.i =================================================================== --- scripts/interface/SBEvent.i +++ scripts/interface/SBEvent.i @@ -124,6 +124,8 @@ bool IsValid() const; + explicit operator bool() const; + const char * GetDataFlavor (); Index: scripts/interface/SBFileSpec.i =================================================================== --- scripts/interface/SBFileSpec.i +++ scripts/interface/SBFileSpec.i @@ -45,6 +45,8 @@ bool IsValid() const; + explicit operator bool() const; + bool Exists () const; Index: scripts/interface/SBFrame.i =================================================================== --- scripts/interface/SBFrame.i +++ scripts/interface/SBFrame.i @@ -59,6 +59,8 @@ bool IsValid() const; + explicit operator bool() const; + uint32_t GetFrameID () const; Index: scripts/interface/SBFunction.i =================================================================== --- scripts/interface/SBFunction.i +++ scripts/interface/SBFunction.i @@ -55,6 +55,8 @@ bool IsValid () const; + explicit operator bool() const; + const char * GetName() const; Index: scripts/interface/SBInstruction.i =================================================================== --- scripts/interface/SBInstruction.i +++ scripts/interface/SBInstruction.i @@ -26,6 +26,8 @@ bool IsValid(); + explicit operator bool() const; + lldb::SBAddress GetAddress(); Index: scripts/interface/SBInstructionList.i =================================================================== --- scripts/interface/SBInstructionList.i +++ scripts/interface/SBInstructionList.i @@ -37,6 +37,8 @@ bool IsValid () const; + explicit operator bool() const; + size_t GetSize (); Index: scripts/interface/SBLineEntry.i =================================================================== --- scripts/interface/SBLineEntry.i +++ scripts/interface/SBLineEntry.i @@ -55,6 +55,8 @@ bool IsValid () const; + explicit operator bool() const; + lldb::SBFileSpec GetFileSpec () const; Index: scripts/interface/SBListener.i =================================================================== --- scripts/interface/SBListener.i +++ scripts/interface/SBListener.i @@ -33,6 +33,8 @@ bool IsValid () const; + explicit operator bool() const; + uint32_t StartListeningForEventClass (SBDebugger &debugger, const char *broadcaster_class, Index: scripts/interface/SBModule.i =================================================================== --- scripts/interface/SBModule.i +++ scripts/interface/SBModule.i @@ -130,6 +130,8 @@ bool IsValid () const; + explicit operator bool() const; + void Clear(); Index: scripts/interface/SBModuleSpec.i =================================================================== --- scripts/interface/SBModuleSpec.i +++ scripts/interface/SBModuleSpec.i @@ -20,6 +20,8 @@ bool IsValid () const; + + explicit operator bool() const; void Clear(); Index: scripts/interface/SBPlatform.i =================================================================== --- scripts/interface/SBPlatform.i +++ scripts/interface/SBPlatform.i @@ -118,6 +118,8 @@ bool IsValid () const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBProcess.i =================================================================== --- scripts/interface/SBProcess.i +++ scripts/interface/SBProcess.i @@ -68,6 +68,8 @@ bool IsValid() const; + explicit operator bool() const; + lldb::SBTarget GetTarget() const; Index: scripts/interface/SBProcessInfo.i =================================================================== --- scripts/interface/SBProcessInfo.i +++ scripts/interface/SBProcessInfo.i @@ -25,6 +25,8 @@ bool IsValid (); + explicit operator bool() const; + const char * GetName (); Index: scripts/interface/SBQueue.i =================================================================== --- scripts/interface/SBQueue.i +++ scripts/interface/SBQueue.i @@ -20,6 +20,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBQueueItem.i =================================================================== --- scripts/interface/SBQueueItem.i +++ scripts/interface/SBQueueItem.i @@ -20,6 +20,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBSection.i =================================================================== --- scripts/interface/SBSection.i +++ scripts/interface/SBSection.i @@ -49,6 +49,8 @@ bool IsValid () const; + explicit operator bool() const; + const char * GetName (); Index: scripts/interface/SBStream.i =================================================================== --- scripts/interface/SBStream.i +++ scripts/interface/SBStream.i @@ -48,6 +48,8 @@ bool IsValid() const; + explicit operator bool() const; + %feature("docstring", " //-------------------------------------------------------------------------- /// If this stream is not redirected to a file, it will maintain a local Index: scripts/interface/SBStringList.i =================================================================== --- scripts/interface/SBStringList.i +++ scripts/interface/SBStringList.i @@ -21,6 +21,8 @@ bool IsValid() const; + explicit operator bool() const; + void AppendString (const char *str); Index: scripts/interface/SBStructuredData.i =================================================================== --- scripts/interface/SBStructuredData.i +++ scripts/interface/SBStructuredData.i @@ -28,6 +28,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear(); Index: scripts/interface/SBSymbol.i =================================================================== --- scripts/interface/SBSymbol.i +++ scripts/interface/SBSymbol.i @@ -27,6 +27,8 @@ bool IsValid () const; + explicit operator bool() const; + const char * GetName() const; Index: scripts/interface/SBSymbolContext.i =================================================================== --- scripts/interface/SBSymbolContext.i +++ scripts/interface/SBSymbolContext.i @@ -57,6 +57,8 @@ bool IsValid () const; + explicit operator bool() const; + lldb::SBModule GetModule (); lldb::SBCompileUnit GetCompileUnit (); lldb::SBFunction GetFunction (); Index: scripts/interface/SBSymbolContextList.i =================================================================== --- scripts/interface/SBSymbolContextList.i +++ scripts/interface/SBSymbolContextList.i @@ -41,6 +41,8 @@ bool IsValid () const; + explicit operator bool() const; + uint32_t GetSize() const; Index: scripts/interface/SBTarget.i =================================================================== --- scripts/interface/SBTarget.i +++ scripts/interface/SBTarget.i @@ -80,6 +80,8 @@ bool IsValid() const; + explicit operator bool() const; + static bool EventIsTargetEvent (const lldb::SBEvent &event); Index: scripts/interface/SBThread.i =================================================================== --- scripts/interface/SBThread.i +++ scripts/interface/SBThread.i @@ -74,6 +74,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear (); Index: scripts/interface/SBThreadCollection.i =================================================================== --- scripts/interface/SBThreadCollection.i +++ scripts/interface/SBThreadCollection.i @@ -25,6 +25,8 @@ bool IsValid () const; + + explicit operator bool() const; size_t GetSize (); Index: scripts/interface/SBThreadPlan.i =================================================================== --- scripts/interface/SBThreadPlan.i +++ scripts/interface/SBThreadPlan.i @@ -40,6 +40,8 @@ bool IsValid() const; + explicit operator bool() const; + void Clear (); @@ -90,6 +92,8 @@ bool IsValid(); + explicit operator bool() const; + // This section allows an SBThreadPlan to push another of the common types of plans... SBThreadPlan QueueThreadPlanForStepOverRange (SBAddress &start_address, Index: scripts/interface/SBTrace.i =================================================================== --- scripts/interface/SBTrace.i +++ scripts/interface/SBTrace.i @@ -29,5 +29,7 @@ bool IsValid(); + explicit operator bool() const; + }; -} // namespace lldb \ No newline at end of file +} // namespace lldb Index: scripts/interface/SBTraceOptions.i =================================================================== --- scripts/interface/SBTraceOptions.i +++ scripts/interface/SBTraceOptions.i @@ -33,5 +33,7 @@ lldb::tid_t getThreadID(); bool IsValid(); + + explicit operator bool() const; }; } Index: scripts/interface/SBType.i =================================================================== --- scripts/interface/SBType.i +++ scripts/interface/SBType.i @@ -24,6 +24,8 @@ bool IsValid() const; + explicit operator bool() const; + const char * GetName (); @@ -78,6 +80,8 @@ bool IsValid() const; + + explicit operator bool() const; const char * GetName (); @@ -196,6 +200,8 @@ bool IsValid(); + explicit operator bool() const; + uint64_t GetByteSize(); @@ -487,6 +493,8 @@ bool IsValid(); + explicit operator bool() const; + void Append (lldb::SBType type); Index: scripts/interface/SBTypeCategory.i =================================================================== --- scripts/interface/SBTypeCategory.i +++ scripts/interface/SBTypeCategory.i @@ -24,6 +24,8 @@ bool IsValid() const; + + explicit operator bool() const; bool GetEnabled (); Index: scripts/interface/SBTypeEnumMember.i =================================================================== --- scripts/interface/SBTypeEnumMember.i +++ scripts/interface/SBTypeEnumMember.i @@ -25,6 +25,8 @@ bool IsValid() const; + explicit operator bool() const; + int64_t GetValueAsSigned(); @@ -90,6 +92,8 @@ bool IsValid(); + explicit operator bool() const; + void Append (SBTypeEnumMember entry); Index: scripts/interface/SBTypeFilter.i =================================================================== --- scripts/interface/SBTypeFilter.i +++ scripts/interface/SBTypeFilter.i @@ -26,6 +26,8 @@ bool IsValid() const; + + explicit operator bool() const; bool IsEqualTo (lldb::SBTypeFilter &rhs); Index: scripts/interface/SBTypeFormat.i =================================================================== --- scripts/interface/SBTypeFormat.i +++ scripts/interface/SBTypeFormat.i @@ -28,6 +28,8 @@ bool IsValid() const; + + explicit operator bool() const; bool IsEqualTo (lldb::SBTypeFormat &rhs); Index: scripts/interface/SBTypeNameSpecifier.i =================================================================== --- scripts/interface/SBTypeNameSpecifier.i +++ scripts/interface/SBTypeNameSpecifier.i @@ -29,6 +29,8 @@ bool IsValid() const; + + explicit operator bool() const; bool IsEqualTo (lldb::SBTypeNameSpecifier &rhs); Index: scripts/interface/SBTypeSummary.i =================================================================== --- scripts/interface/SBTypeSummary.i +++ scripts/interface/SBTypeSummary.i @@ -18,6 +18,8 @@ bool IsValid (); + + explicit operator bool() const; lldb::LanguageType GetLanguage (); @@ -57,6 +59,8 @@ bool IsValid() const; + + explicit operator bool() const; bool IsEqualTo (lldb::SBTypeSummary &rhs); Index: scripts/interface/SBTypeSynthetic.i =================================================================== --- scripts/interface/SBTypeSynthetic.i +++ scripts/interface/SBTypeSynthetic.i @@ -30,6 +30,8 @@ bool IsValid() const; + + explicit operator bool() const; bool IsEqualTo (lldb::SBTypeSynthetic &rhs); Index: scripts/interface/SBUnixSignals.i =================================================================== --- scripts/interface/SBUnixSignals.i +++ scripts/interface/SBUnixSignals.i @@ -26,6 +26,8 @@ bool IsValid () const; + explicit operator bool() const; + const char * GetSignalAsCString (int32_t signo) const; Index: scripts/interface/SBValue.i =================================================================== --- scripts/interface/SBValue.i +++ scripts/interface/SBValue.i @@ -65,6 +65,8 @@ bool IsValid(); + + explicit operator bool() const; void Clear(); Index: scripts/interface/SBValueList.i =================================================================== --- scripts/interface/SBValueList.i +++ scripts/interface/SBValueList.i @@ -77,6 +77,8 @@ bool IsValid() const; + + explicit operator bool() const; void Clear(); Index: scripts/interface/SBVariablesOptions.i =================================================================== --- scripts/interface/SBVariablesOptions.i +++ scripts/interface/SBVariablesOptions.i @@ -19,6 +19,8 @@ bool IsValid () const; + + explicit operator bool() const; bool GetIncludeArguments () const; Index: scripts/interface/SBWatchpoint.i =================================================================== --- scripts/interface/SBWatchpoint.i +++ scripts/interface/SBWatchpoint.i @@ -30,6 +30,8 @@ bool IsValid(); + explicit operator bool() const; + SBError GetError(); Index: scripts/lldb.swig =================================================================== --- scripts/lldb.swig +++ scripts/lldb.swig @@ -95,9 +95,8 @@ # ============================================================================== # The modify-python-lldb.py script is responsible for post-processing this SWIG- # generated lldb.py module. It is responsible for adding support for: iteration -# protocol: __iter__, rich comparison methods: __eq__ and __ne__, truth value -# testing (and built-in operation bool()): __nonzero__, and built-in function -# len(): __len__. +# protocol: __iter__, rich comparison methods: __eq__ and __ne__, and built-in +# function len(): __len__. # ============================================================================== %} Index: source/API/SBAddress.cpp =================================================================== --- source/API/SBAddress.cpp +++ source/API/SBAddress.cpp @@ -60,7 +60,9 @@ return false; } -bool SBAddress::IsValid() const { +bool SBAddress::IsValid() const { return bool(*this); } + +SBAddress::operator bool() const { return m_opaque_up != NULL && m_opaque_up->IsValid(); } Index: source/API/SBBlock.cpp =================================================================== --- source/API/SBBlock.cpp +++ source/API/SBBlock.cpp @@ -39,7 +39,9 @@ SBBlock::~SBBlock() { m_opaque_ptr = NULL; } -bool SBBlock::IsValid() const { return m_opaque_ptr != NULL; } +bool SBBlock::IsValid() const { return bool(*this); } + +SBBlock::operator bool() const { return m_opaque_ptr != NULL; } bool SBBlock::IsInlined() const { if (m_opaque_ptr) Index: source/API/SBBreakpoint.cpp =================================================================== --- source/API/SBBreakpoint.cpp +++ source/API/SBBreakpoint.cpp @@ -78,7 +78,9 @@ return break_id; } -bool SBBreakpoint::IsValid() const { +bool SBBreakpoint::IsValid() const { return bool(*this); } + +SBBreakpoint::operator bool() const { BreakpointSP bkpt_sp = GetSP(); if (!bkpt_sp) return false; Index: source/API/SBBreakpointLocation.cpp =================================================================== --- source/API/SBBreakpointLocation.cpp +++ source/API/SBBreakpointLocation.cpp @@ -58,7 +58,9 @@ return m_opaque_wp.lock(); } -bool SBBreakpointLocation::IsValid() const { return bool(GetSP()); } +bool SBBreakpointLocation::IsValid() const { return bool(*this); } + +SBBreakpointLocation::operator bool() const { return bool(GetSP()); } SBAddress SBBreakpointLocation::GetAddress() { BreakpointLocationSP loc_sp = GetSP(); Index: source/API/SBBreakpointName.cpp =================================================================== --- source/API/SBBreakpointName.cpp +++ source/API/SBBreakpointName.cpp @@ -170,7 +170,9 @@ return *m_impl_up != *rhs.m_impl_up; } -bool SBBreakpointName::IsValid() const { +bool SBBreakpointName::IsValid() const { return bool(*this); } + +SBBreakpointName::operator bool() const { if (!m_impl_up) return false; return m_impl_up->IsValid(); Index: source/API/SBBroadcaster.cpp =================================================================== --- source/API/SBBroadcaster.cpp +++ source/API/SBBroadcaster.cpp @@ -130,7 +130,9 @@ m_opaque_ptr = broadcaster; } -bool SBBroadcaster::IsValid() const { return m_opaque_ptr != NULL; } +bool SBBroadcaster::IsValid() const { return bool(*this); } + +SBBroadcaster::operator bool() const { return m_opaque_ptr != NULL; } void SBBroadcaster::Clear() { m_opaque_sp.reset(); Index: source/API/SBCommandInterpreter.cpp =================================================================== --- source/API/SBCommandInterpreter.cpp +++ source/API/SBCommandInterpreter.cpp @@ -150,7 +150,9 @@ return *this; } -bool SBCommandInterpreter::IsValid() const { return m_opaque_ptr != nullptr; } +bool SBCommandInterpreter::IsValid() const { return bool(*this); } + +SBCommandInterpreter::operator bool() const { return m_opaque_ptr != nullptr; } bool SBCommandInterpreter::CommandExists(const char *cmd) { return (((cmd != nullptr) && IsValid()) ? m_opaque_ptr->CommandExists(cmd) @@ -584,7 +586,9 @@ SBCommand::SBCommand(lldb::CommandObjectSP cmd_sp) : m_opaque_sp(cmd_sp) {} -bool SBCommand::IsValid() { return m_opaque_sp.get() != nullptr; } +bool SBCommand::IsValid() { return bool(*this); } + +SBCommand::operator bool() const { return m_opaque_sp.get() != nullptr; } const char *SBCommand::GetName() { return (IsValid() ? ConstString(m_opaque_sp->GetCommandName()).AsCString() : nullptr); Index: source/API/SBCommandReturnObject.cpp =================================================================== --- source/API/SBCommandReturnObject.cpp +++ source/API/SBCommandReturnObject.cpp @@ -47,7 +47,9 @@ return *this; } -bool SBCommandReturnObject::IsValid() const { return m_opaque_up != nullptr; } +bool SBCommandReturnObject::IsValid() const { return bool(*this); } + +SBCommandReturnObject::operator bool() const { return m_opaque_up != nullptr; } const char *SBCommandReturnObject::GetOutput() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBCommunication.cpp =================================================================== --- source/API/SBCommunication.cpp +++ source/API/SBCommunication.cpp @@ -35,7 +35,9 @@ m_opaque_owned = false; } -bool SBCommunication::IsValid() const { return m_opaque != NULL; } +bool SBCommunication::IsValid() const { return bool(*this); } + +SBCommunication::operator bool() const { return m_opaque != NULL; } bool SBCommunication::GetCloseOnEOF() { if (m_opaque) Index: source/API/SBCompileUnit.cpp =================================================================== --- source/API/SBCompileUnit.cpp +++ source/API/SBCompileUnit.cpp @@ -190,7 +190,9 @@ return lldb::eLanguageTypeUnknown; } -bool SBCompileUnit::IsValid() const { return m_opaque_ptr != NULL; } +bool SBCompileUnit::IsValid() const { return bool(*this); } + +SBCompileUnit::operator bool() const { return m_opaque_ptr != NULL; } bool SBCompileUnit::operator==(const SBCompileUnit &rhs) const { return m_opaque_ptr == rhs.m_opaque_ptr; Index: source/API/SBData.cpp =================================================================== --- source/API/SBData.cpp +++ source/API/SBData.cpp @@ -50,7 +50,9 @@ const lldb::DataExtractorSP &SBData::operator*() const { return m_opaque_sp; } -bool SBData::IsValid() { return m_opaque_sp.get() != NULL; } +bool SBData::IsValid() { return bool(*this); } + +SBData::operator bool() const { return m_opaque_sp.get() != NULL; } uint8_t SBData::GetAddressByteSize() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBDebugger.cpp =================================================================== --- source/API/SBDebugger.cpp +++ source/API/SBDebugger.cpp @@ -275,7 +275,9 @@ ModuleList::RemoveOrphanSharedModules(mandatory); } -bool SBDebugger::IsValid() const { return m_opaque_sp.get() != nullptr; } +bool SBDebugger::IsValid() const { return bool(*this); } + +SBDebugger::operator bool() const { return m_opaque_sp.get() != nullptr; } void SBDebugger::SetAsync(bool b) { if (m_opaque_sp) Index: source/API/SBDeclaration.cpp =================================================================== --- source/API/SBDeclaration.cpp +++ source/API/SBDeclaration.cpp @@ -48,7 +48,9 @@ SBDeclaration::~SBDeclaration() {} -bool SBDeclaration::IsValid() const { +bool SBDeclaration::IsValid() const { return bool(*this); } + +SBDeclaration::operator bool() const { return m_opaque_up.get() && m_opaque_up->IsValid(); } Index: source/API/SBError.cpp =================================================================== --- source/API/SBError.cpp +++ source/API/SBError.cpp @@ -136,7 +136,9 @@ return num_chars; } -bool SBError::IsValid() const { return m_opaque_up != NULL; } +bool SBError::IsValid() const { return bool(*this); } + +SBError::operator bool() const { return m_opaque_up != NULL; } void SBError::CreateIfNeeded() { if (m_opaque_up == NULL) Index: source/API/SBEvent.cpp =================================================================== --- source/API/SBEvent.cpp +++ source/API/SBEvent.cpp @@ -144,7 +144,9 @@ m_event_sp.reset(); } -bool SBEvent::IsValid() const { +bool SBEvent::IsValid() const { return bool(*this); } + +SBEvent::operator bool() const { // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() accessor. // See comments in SBEvent::get().... return SBEvent::get() != NULL; Index: source/API/SBFileSpec.cpp =================================================================== --- source/API/SBFileSpec.cpp +++ source/API/SBFileSpec.cpp @@ -49,7 +49,9 @@ return *this; } -bool SBFileSpec::IsValid() const { return m_opaque_up->operator bool(); } +bool SBFileSpec::IsValid() const { return bool(*this); } + +SBFileSpec::operator bool() const { return m_opaque_up->operator bool(); } bool SBFileSpec::Exists() const { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBFrame.cpp =================================================================== --- source/API/SBFrame.cpp +++ source/API/SBFrame.cpp @@ -87,7 +87,9 @@ return m_opaque_sp->SetFrameSP(lldb_object_sp); } -bool SBFrame::IsValid() const { +bool SBFrame::IsValid() const { return bool(*this); } + +SBFrame::operator bool() const { std::unique_lock lock; ExecutionContext exe_ctx(m_opaque_sp.get(), lock); Index: source/API/SBFunction.cpp =================================================================== --- source/API/SBFunction.cpp +++ source/API/SBFunction.cpp @@ -37,7 +37,9 @@ SBFunction::~SBFunction() { m_opaque_ptr = NULL; } -bool SBFunction::IsValid() const { return m_opaque_ptr != NULL; } +bool SBFunction::IsValid() const { return bool(*this); } + +SBFunction::operator bool() const { return m_opaque_ptr != NULL; } const char *SBFunction::GetName() const { const char *cstr = NULL; Index: source/API/SBInstruction.cpp =================================================================== --- source/API/SBInstruction.cpp +++ source/API/SBInstruction.cpp @@ -83,7 +83,11 @@ SBInstruction::~SBInstruction() {} -bool SBInstruction::IsValid() { return m_opaque_sp && m_opaque_sp->IsValid(); } +bool SBInstruction::IsValid() { return bool(*this); } + +SBInstruction::operator bool() const { + return m_opaque_sp && m_opaque_sp->IsValid(); +} SBAddress SBInstruction::GetAddress() { SBAddress sb_addr; Index: source/API/SBInstructionList.cpp =================================================================== --- source/API/SBInstructionList.cpp +++ source/API/SBInstructionList.cpp @@ -32,7 +32,9 @@ SBInstructionList::~SBInstructionList() {} -bool SBInstructionList::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBInstructionList::IsValid() const { return bool(*this); } + +SBInstructionList::operator bool() const { return m_opaque_sp.get() != NULL; } size_t SBInstructionList::GetSize() { if (m_opaque_sp) Index: source/API/SBLineEntry.cpp =================================================================== --- source/API/SBLineEntry.cpp +++ source/API/SBLineEntry.cpp @@ -87,7 +87,9 @@ return sb_address; } -bool SBLineEntry::IsValid() const { +bool SBLineEntry::IsValid() const { return bool(*this); } + +SBLineEntry::operator bool() const { return m_opaque_up.get() && m_opaque_up->IsValid(); } Index: source/API/SBListener.cpp =================================================================== --- source/API/SBListener.cpp +++ source/API/SBListener.cpp @@ -47,7 +47,9 @@ SBListener::~SBListener() {} -bool SBListener::IsValid() const { return m_opaque_sp != nullptr; } +bool SBListener::IsValid() const { return bool(*this); } + +SBListener::operator bool() const { return m_opaque_sp != nullptr; } void SBListener::AddEvent(const SBEvent &event) { EventSP &event_sp = event.GetSP(); Index: source/API/SBModule.cpp =================================================================== --- source/API/SBModule.cpp +++ source/API/SBModule.cpp @@ -66,7 +66,9 @@ SBModule::~SBModule() {} -bool SBModule::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBModule::IsValid() const { return bool(*this); } + +SBModule::operator bool() const { return m_opaque_sp.get() != NULL; } void SBModule::Clear() { m_opaque_sp.reset(); } Index: source/API/SBModuleSpec.cpp =================================================================== --- source/API/SBModuleSpec.cpp +++ source/API/SBModuleSpec.cpp @@ -30,7 +30,9 @@ SBModuleSpec::~SBModuleSpec() {} -bool SBModuleSpec::IsValid() const { return m_opaque_up->operator bool(); } +bool SBModuleSpec::IsValid() const { return bool(*this); } + +SBModuleSpec::operator bool() const { return m_opaque_up->operator bool(); } void SBModuleSpec::Clear() { m_opaque_up->Clear(); } Index: source/API/SBPlatform.cpp =================================================================== --- source/API/SBPlatform.cpp +++ source/API/SBPlatform.cpp @@ -215,7 +215,9 @@ SBPlatform::~SBPlatform() {} -bool SBPlatform::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBPlatform::IsValid() const { return bool(*this); } + +SBPlatform::operator bool() const { return m_opaque_sp.get() != NULL; } void SBPlatform::Clear() { m_opaque_sp.reset(); } Index: source/API/SBProcess.cpp =================================================================== --- source/API/SBProcess.cpp +++ source/API/SBProcess.cpp @@ -96,7 +96,9 @@ void SBProcess::Clear() { m_opaque_wp.reset(); } -bool SBProcess::IsValid() const { +bool SBProcess::IsValid() const { return bool(*this); } + +SBProcess::operator bool() const { ProcessSP process_sp(m_opaque_wp.lock()); return ((bool)process_sp && process_sp->IsValid()); } Index: source/API/SBProcessInfo.cpp =================================================================== --- source/API/SBProcessInfo.cpp +++ source/API/SBProcessInfo.cpp @@ -45,7 +45,9 @@ ref() = proc_info_ref; } -bool SBProcessInfo::IsValid() const { return m_opaque_up != nullptr; } +bool SBProcessInfo::IsValid() const { return bool(*this); } + +SBProcessInfo::operator bool() const { return m_opaque_up != nullptr; } const char *SBProcessInfo::GetName() { const char *name = nullptr; Index: source/API/SBQueue.cpp =================================================================== --- source/API/SBQueue.cpp +++ source/API/SBQueue.cpp @@ -250,7 +250,9 @@ SBQueue::~SBQueue() {} -bool SBQueue::IsValid() const { +bool SBQueue::IsValid() const { return bool(*this); } + +SBQueue::operator bool() const { bool is_valid = m_opaque_sp->IsValid(); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (log) Index: source/API/SBQueueItem.cpp =================================================================== --- source/API/SBQueueItem.cpp +++ source/API/SBQueueItem.cpp @@ -33,7 +33,9 @@ //---------------------------------------------------------------------- SBQueueItem::~SBQueueItem() { m_queue_item_sp.reset(); } -bool SBQueueItem::IsValid() const { +bool SBQueueItem::IsValid() const { return bool(*this); } + +SBQueueItem::operator bool() const { bool is_valid = m_queue_item_sp.get() != NULL; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); if (log) Index: source/API/SBSection.cpp =================================================================== --- source/API/SBSection.cpp +++ source/API/SBSection.cpp @@ -39,7 +39,9 @@ SBSection::~SBSection() {} -bool SBSection::IsValid() const { +bool SBSection::IsValid() const { return bool(*this); } + +SBSection::operator bool() const { SectionSP section_sp(GetSP()); return section_sp && section_sp->GetModule().get() != NULL; } Index: source/API/SBStream.cpp =================================================================== --- source/API/SBStream.cpp +++ source/API/SBStream.cpp @@ -24,7 +24,9 @@ SBStream::~SBStream() {} -bool SBStream::IsValid() const { return (m_opaque_up != NULL); } +bool SBStream::IsValid() const { return bool(*this); } + +SBStream::operator bool() const { return (m_opaque_up != NULL); } // If this stream is not redirected to a file, it will maintain a local cache // for the stream data which can be accessed using this accessor. Index: source/API/SBStringList.cpp =================================================================== --- source/API/SBStringList.cpp +++ source/API/SBStringList.cpp @@ -46,7 +46,9 @@ return *m_opaque_up; } -bool SBStringList::IsValid() const { return (m_opaque_up != NULL); } +bool SBStringList::IsValid() const { return bool(*this); } + +SBStringList::operator bool() const { return (m_opaque_up != NULL); } void SBStringList::AppendString(const char *str) { if (str != NULL) { Index: source/API/SBStructuredData.cpp =================================================================== --- source/API/SBStructuredData.cpp +++ source/API/SBStructuredData.cpp @@ -54,7 +54,9 @@ return error; } -bool SBStructuredData::IsValid() const { return m_impl_up->IsValid(); } +bool SBStructuredData::IsValid() const { return bool(*this); } + +SBStructuredData::operator bool() const { return m_impl_up->IsValid(); } void SBStructuredData::Clear() { m_impl_up->Clear(); } Index: source/API/SBSymbol.cpp =================================================================== --- source/API/SBSymbol.cpp +++ source/API/SBSymbol.cpp @@ -37,7 +37,9 @@ m_opaque_ptr = lldb_object_ptr; } -bool SBSymbol::IsValid() const { return m_opaque_ptr != NULL; } +bool SBSymbol::IsValid() const { return bool(*this); } + +SBSymbol::operator bool() const { return m_opaque_ptr != NULL; } const char *SBSymbol::GetName() const { const char *name = NULL; Index: source/API/SBSymbolContext.cpp =================================================================== --- source/API/SBSymbolContext.cpp +++ source/API/SBSymbolContext.cpp @@ -55,7 +55,9 @@ } } -bool SBSymbolContext::IsValid() const { return m_opaque_up != NULL; } +bool SBSymbolContext::IsValid() const { return bool(*this); } + +SBSymbolContext::operator bool() const { return m_opaque_up != NULL; } SBModule SBSymbolContext::GetModule() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBSymbolContextList.cpp =================================================================== --- source/API/SBSymbolContextList.cpp +++ source/API/SBSymbolContextList.cpp @@ -61,7 +61,9 @@ m_opaque_up->Append(*sc_list); } -bool SBSymbolContextList::IsValid() const { return m_opaque_up != NULL; } +bool SBSymbolContextList::IsValid() const { return bool(*this); } + +SBSymbolContextList::operator bool() const { return m_opaque_up != NULL; } lldb_private::SymbolContextList *SBSymbolContextList::operator->() const { return m_opaque_up.get(); Index: source/API/SBTarget.cpp =================================================================== --- source/API/SBTarget.cpp +++ source/API/SBTarget.cpp @@ -141,7 +141,9 @@ return Target::GetStaticBroadcasterClass().AsCString(); } -bool SBTarget::IsValid() const { +bool SBTarget::IsValid() const { return bool(*this); } + +SBTarget::operator bool() const { return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid(); } Index: source/API/SBThread.cpp =================================================================== --- source/API/SBThread.cpp +++ source/API/SBThread.cpp @@ -108,7 +108,9 @@ return sb_queue; } -bool SBThread::IsValid() const { +bool SBThread::IsValid() const { return bool(*this); } + +SBThread::operator bool() const { std::unique_lock lock; ExecutionContext exe_ctx(m_opaque_sp.get(), lock); Index: source/API/SBThreadCollection.cpp =================================================================== --- source/API/SBThreadCollection.cpp +++ source/API/SBThreadCollection.cpp @@ -50,7 +50,9 @@ return m_opaque_sp; } -bool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBThreadCollection::IsValid() const { return bool(*this); } + +SBThreadCollection::operator bool() const { return m_opaque_sp.get() != NULL; } size_t SBThreadCollection::GetSize() { if (m_opaque_sp) Index: source/API/SBThreadPlan.cpp =================================================================== --- source/API/SBThreadPlan.cpp +++ source/API/SBThreadPlan.cpp @@ -79,6 +79,8 @@ lldb_private::ThreadPlan *SBThreadPlan::get() { return m_opaque_sp.get(); } +bool SBThreadPlan::IsValid() { return bool(*this); } + bool SBThreadPlan::IsValid() const { return m_opaque_sp.get() != NULL; } void SBThreadPlan::Clear() { m_opaque_sp.reset(); } @@ -128,7 +130,7 @@ return true; } -bool SBThreadPlan::IsValid() { +SBThreadPlan::operator bool() const { if (m_opaque_sp) return m_opaque_sp->ValidatePlan(nullptr); else Index: source/API/SBTrace.cpp =================================================================== --- source/API/SBTrace.cpp +++ source/API/SBTrace.cpp @@ -101,7 +101,9 @@ void SBTrace::SetSP(const ProcessSP &process_sp) { m_opaque_wp = process_sp; } -bool SBTrace::IsValid() { +bool SBTrace::IsValid() { return bool(*this); } + +SBTrace::operator bool() const { if (!m_trace_impl_sp) return false; if (!GetSP()) Index: source/API/SBTraceOptions.cpp =================================================================== --- source/API/SBTraceOptions.cpp +++ source/API/SBTraceOptions.cpp @@ -77,7 +77,9 @@ m_traceoptions_sp->setMetaDataBufferSize(size); } -bool SBTraceOptions::IsValid() { +bool SBTraceOptions::IsValid() { return bool(*this); } + +SBTraceOptions::operator bool() const { if (m_traceoptions_sp) return true; return false; Index: source/API/SBType.cpp =================================================================== --- source/API/SBType.cpp +++ source/API/SBType.cpp @@ -96,7 +96,9 @@ return *m_opaque_sp; } -bool SBType::IsValid() const { +bool SBType::IsValid() const { return bool(*this); } + +SBType::operator bool() const { if (m_opaque_sp.get() == NULL) return false; @@ -453,7 +455,9 @@ Append(const_cast(rhs).GetTypeAtIndex(i)); } -bool SBTypeList::IsValid() { return (m_opaque_up != NULL); } +bool SBTypeList::IsValid() { return bool(*this); } + +SBTypeList::operator bool() const { return (m_opaque_up != NULL); } SBTypeList &SBTypeList::operator=(const SBTypeList &rhs) { if (this != &rhs) { @@ -499,7 +503,9 @@ return *this; } -bool SBTypeMember::IsValid() const { return m_opaque_up.get(); } +bool SBTypeMember::IsValid() const { return bool(*this); } + +SBTypeMember::operator bool() const { return m_opaque_up.get(); } const char *SBTypeMember::GetName() { if (m_opaque_up) @@ -594,7 +600,9 @@ return *this; } -bool SBTypeMemberFunction::IsValid() const { return m_opaque_sp.get(); } +bool SBTypeMemberFunction::IsValid() const { return bool(*this); } + +SBTypeMemberFunction::operator bool() const { return m_opaque_sp.get(); } const char *SBTypeMemberFunction::GetName() { if (m_opaque_sp) Index: source/API/SBTypeCategory.cpp =================================================================== --- source/API/SBTypeCategory.cpp +++ source/API/SBTypeCategory.cpp @@ -37,7 +37,9 @@ SBTypeCategory::~SBTypeCategory() {} -bool SBTypeCategory::IsValid() const { return (m_opaque_sp.get() != NULL); } +bool SBTypeCategory::IsValid() const { return bool(*this); } + +SBTypeCategory::operator bool() const { return (m_opaque_sp.get() != NULL); } bool SBTypeCategory::GetEnabled() { if (!IsValid()) Index: source/API/SBTypeEnumMember.cpp =================================================================== --- source/API/SBTypeEnumMember.cpp +++ source/API/SBTypeEnumMember.cpp @@ -42,7 +42,9 @@ return *this; } -bool SBTypeEnumMember::IsValid() const { return m_opaque_sp.get(); } +bool SBTypeEnumMember::IsValid() const { return bool(*this); } + +SBTypeEnumMember::operator bool() const { return m_opaque_sp.get(); } const char *SBTypeEnumMember::GetName() { if (m_opaque_sp.get()) @@ -95,7 +97,9 @@ Append(const_cast(rhs).GetTypeEnumMemberAtIndex(i)); } -bool SBTypeEnumMemberList::IsValid() { return (m_opaque_up != NULL); } +bool SBTypeEnumMemberList::IsValid() { return bool(*this); } + +SBTypeEnumMemberList::operator bool() const { return (m_opaque_up != NULL); } SBTypeEnumMemberList &SBTypeEnumMemberList:: operator=(const SBTypeEnumMemberList &rhs) { Index: source/API/SBTypeFilter.cpp =================================================================== --- source/API/SBTypeFilter.cpp +++ source/API/SBTypeFilter.cpp @@ -26,7 +26,9 @@ SBTypeFilter::~SBTypeFilter() {} -bool SBTypeFilter::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBTypeFilter::IsValid() const { return bool(*this); } + +SBTypeFilter::operator bool() const { return m_opaque_sp.get() != NULL; } uint32_t SBTypeFilter::GetOptions() { if (IsValid()) Index: source/API/SBTypeFormat.cpp =================================================================== --- source/API/SBTypeFormat.cpp +++ source/API/SBTypeFormat.cpp @@ -31,7 +31,9 @@ SBTypeFormat::~SBTypeFormat() {} -bool SBTypeFormat::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBTypeFormat::IsValid() const { return bool(*this); } + +SBTypeFormat::operator bool() const { return m_opaque_sp.get() != NULL; } lldb::Format SBTypeFormat::GetFormat() { if (IsValid() && m_opaque_sp->GetType() == TypeFormatImpl::Type::eTypeFormat) Index: source/API/SBTypeNameSpecifier.cpp =================================================================== --- source/API/SBTypeNameSpecifier.cpp +++ source/API/SBTypeNameSpecifier.cpp @@ -36,7 +36,9 @@ SBTypeNameSpecifier::~SBTypeNameSpecifier() {} -bool SBTypeNameSpecifier::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBTypeNameSpecifier::IsValid() const { return bool(*this); } + +SBTypeNameSpecifier::operator bool() const { return m_opaque_sp.get() != NULL; } const char *SBTypeNameSpecifier::GetName() { if (!IsValid()) Index: source/API/SBTypeSummary.cpp =================================================================== --- source/API/SBTypeSummary.cpp +++ source/API/SBTypeSummary.cpp @@ -31,7 +31,9 @@ SBTypeSummaryOptions::~SBTypeSummaryOptions() {} -bool SBTypeSummaryOptions::IsValid() { return m_opaque_up.get(); } +bool SBTypeSummaryOptions::IsValid() { return bool(*this); } + +SBTypeSummaryOptions::operator bool() const { return m_opaque_up.get(); } lldb::LanguageType SBTypeSummaryOptions::GetLanguage() { if (IsValid()) @@ -146,7 +148,9 @@ SBTypeSummary::~SBTypeSummary() {} -bool SBTypeSummary::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBTypeSummary::IsValid() const { return bool(*this); } + +SBTypeSummary::operator bool() const { return m_opaque_sp.get() != NULL; } bool SBTypeSummary::IsFunctionCode() { if (!IsValid()) Index: source/API/SBTypeSynthetic.cpp =================================================================== --- source/API/SBTypeSynthetic.cpp +++ source/API/SBTypeSynthetic.cpp @@ -41,7 +41,9 @@ SBTypeSynthetic::~SBTypeSynthetic() {} -bool SBTypeSynthetic::IsValid() const { return m_opaque_sp.get() != NULL; } +bool SBTypeSynthetic::IsValid() const { return bool(*this); } + +SBTypeSynthetic::operator bool() const { return m_opaque_sp.get() != NULL; } bool SBTypeSynthetic::IsClassCode() { if (!IsValid()) Index: source/API/SBUnixSignals.cpp =================================================================== --- source/API/SBUnixSignals.cpp +++ source/API/SBUnixSignals.cpp @@ -45,7 +45,9 @@ void SBUnixSignals::Clear() { m_opaque_wp.reset(); } -bool SBUnixSignals::IsValid() const { return static_cast(GetSP()); } +bool SBUnixSignals::IsValid() const { return bool(*this); } + +SBUnixSignals::operator bool() const { return static_cast(GetSP()); } const char *SBUnixSignals::GetSignalAsCString(int32_t signo) const { if (auto signals_sp = GetSP()) Index: source/API/SBValue.cpp =================================================================== --- source/API/SBValue.cpp +++ source/API/SBValue.cpp @@ -234,7 +234,9 @@ SBValue::~SBValue() {} -bool SBValue::IsValid() { +bool SBValue::IsValid() { return bool(*this); } + +SBValue::operator bool() const { // If this function ever changes to anything that does more than just check // if the opaque shared pointer is non NULL, then we need to update all "if // (m_opaque_sp)" code in this file. Index: source/API/SBValueList.cpp =================================================================== --- source/API/SBValueList.cpp +++ source/API/SBValueList.cpp @@ -98,7 +98,9 @@ SBValueList::~SBValueList() {} -bool SBValueList::IsValid() const { return (m_opaque_up != NULL); } +bool SBValueList::IsValid() const { return bool(*this); } + +SBValueList::operator bool() const { return (m_opaque_up != NULL); } void SBValueList::Clear() { m_opaque_up.reset(); } Index: source/API/SBVariablesOptions.cpp =================================================================== --- source/API/SBVariablesOptions.cpp +++ source/API/SBVariablesOptions.cpp @@ -93,7 +93,9 @@ SBVariablesOptions::~SBVariablesOptions() = default; -bool SBVariablesOptions::IsValid() const { return m_opaque_up != nullptr; } +bool SBVariablesOptions::IsValid() const { return bool(*this); } + +SBVariablesOptions::operator bool() const { return m_opaque_up != nullptr; } bool SBVariablesOptions::GetIncludeArguments() const { return m_opaque_up->GetIncludeArguments(); Index: source/API/SBWatchpoint.cpp =================================================================== --- source/API/SBWatchpoint.cpp +++ source/API/SBWatchpoint.cpp @@ -69,7 +69,9 @@ return watch_id; } -bool SBWatchpoint::IsValid() const { return bool(m_opaque_wp.lock()); } +bool SBWatchpoint::IsValid() const { return bool(*this); } + +SBWatchpoint::operator bool() const { return bool(m_opaque_wp.lock()); } SBError SBWatchpoint::GetError() { SBError sb_error;