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(); + 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 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(); + 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(); + 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 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(); + 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(); + bool CommandExists(const char *cmd); bool AliasExists(const char *cmd); @@ -274,6 +276,8 @@ bool IsValid(); + explicit operator bool(); + 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 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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 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(); + 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(); + 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 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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 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(); + 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(); + 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 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(); + // 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(); + 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(); + 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 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 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + 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 char *GetName(); lldb::SBType GetType(); @@ -66,6 +68,8 @@ bool IsValid() const; + explicit operator bool(); + const char *GetName(); const char *GetDemangledName(); @@ -107,6 +111,8 @@ bool IsValid() const; + explicit operator bool(); + uint64_t GetByteSize(); bool IsPointerType(); @@ -237,6 +243,8 @@ bool IsValid(); + explicit operator bool(); + 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(); + 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(); + int64_t GetValueAsSigned(); uint64_t GetValueAsUnsigned(); @@ -64,6 +66,8 @@ bool IsValid(); + explicit operator bool(); + 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(); + 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(); + 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 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(); + lldb::LanguageType GetLanguage(); lldb::TypeSummaryCapping GetCapping(); @@ -81,6 +83,8 @@ bool IsValid() const; + explicit operator bool(); + 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(); + 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 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(); + 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(); + 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(); + 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(); + 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(); + 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(); + %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(); + 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(); + 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 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(); + 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 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 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(); + 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(); + 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(); + 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(); + 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(); 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(); + 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 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(); + 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(); + 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 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(); + 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(); + 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(); + 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(); + 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(); + 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(); 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(); + 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(); + 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 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(); + 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(); + 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 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(); + %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(); + 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(); + 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 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(); + 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(); + 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(); + 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(); + 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(); 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(); + void Clear (); @@ -90,6 +92,8 @@ bool IsValid(); + explicit operator bool(); + // 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(); + }; -} // 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(); }; } Index: scripts/interface/SBType.i =================================================================== --- scripts/interface/SBType.i +++ scripts/interface/SBType.i @@ -24,6 +24,8 @@ bool IsValid() const; + explicit operator bool(); + const char * GetName (); @@ -78,6 +80,8 @@ bool IsValid() const; + + explicit operator bool(); const char * GetName (); @@ -196,6 +200,8 @@ bool IsValid(); + explicit operator bool(); + uint64_t GetByteSize(); @@ -487,6 +493,8 @@ bool IsValid(); + explicit operator bool(); + 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(); 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(); + int64_t GetValueAsSigned(); @@ -90,6 +92,8 @@ bool IsValid(); + explicit operator bool(); + 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(); 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(); 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(); 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(); lldb::LanguageType GetLanguage (); @@ -57,6 +59,8 @@ bool IsValid() const; + + explicit operator bool(); 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(); 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 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(); 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(); 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(); 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(); + 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,6 +60,8 @@ return false; } +SBAddress::operator bool() { return IsValid(); } + bool SBAddress::IsValid() const { return m_opaque_up != NULL && m_opaque_up->IsValid(); } Index: source/API/SBBlock.cpp =================================================================== --- source/API/SBBlock.cpp +++ source/API/SBBlock.cpp @@ -39,6 +39,8 @@ SBBlock::~SBBlock() { m_opaque_ptr = NULL; } +SBBlock::operator bool() { return IsValid(); } + bool SBBlock::IsValid() const { return m_opaque_ptr != NULL; } bool SBBlock::IsInlined() const { Index: source/API/SBBreakpoint.cpp =================================================================== --- source/API/SBBreakpoint.cpp +++ source/API/SBBreakpoint.cpp @@ -78,6 +78,8 @@ return break_id; } +SBBreakpoint::operator bool() { return IsValid(); } + bool SBBreakpoint::IsValid() const { BreakpointSP bkpt_sp = GetSP(); if (!bkpt_sp) Index: source/API/SBBreakpointLocation.cpp =================================================================== --- source/API/SBBreakpointLocation.cpp +++ source/API/SBBreakpointLocation.cpp @@ -58,6 +58,8 @@ return m_opaque_wp.lock(); } +SBBreakpointLocation::operator bool() { return IsValid(); } + bool SBBreakpointLocation::IsValid() const { return bool(GetSP()); } SBAddress SBBreakpointLocation::GetAddress() { Index: source/API/SBBreakpointName.cpp =================================================================== --- source/API/SBBreakpointName.cpp +++ source/API/SBBreakpointName.cpp @@ -170,6 +170,8 @@ return *m_impl_up != *rhs.m_impl_up; } +SBBreakpointName::operator bool() { return IsValid(); } + bool SBBreakpointName::IsValid() const { if (!m_impl_up) return false; Index: source/API/SBBroadcaster.cpp =================================================================== --- source/API/SBBroadcaster.cpp +++ source/API/SBBroadcaster.cpp @@ -130,6 +130,8 @@ m_opaque_ptr = broadcaster; } +SBBroadcaster::operator bool() { return IsValid(); } + bool SBBroadcaster::IsValid() const { return m_opaque_ptr != NULL; } void SBBroadcaster::Clear() { Index: source/API/SBCommandInterpreter.cpp =================================================================== --- source/API/SBCommandInterpreter.cpp +++ source/API/SBCommandInterpreter.cpp @@ -150,6 +150,8 @@ return *this; } +SBCommandInterpreter::operator bool() { return IsValid(); } + bool SBCommandInterpreter::IsValid() const { return m_opaque_ptr != nullptr; } bool SBCommandInterpreter::CommandExists(const char *cmd) { @@ -584,6 +586,8 @@ SBCommand::SBCommand(lldb::CommandObjectSP cmd_sp) : m_opaque_sp(cmd_sp) {} +SBCommand::operator bool() { return IsValid(); } + bool SBCommand::IsValid() { return m_opaque_sp.get() != nullptr; } const char *SBCommand::GetName() { Index: source/API/SBCommandReturnObject.cpp =================================================================== --- source/API/SBCommandReturnObject.cpp +++ source/API/SBCommandReturnObject.cpp @@ -47,6 +47,8 @@ return *this; } +SBCommandReturnObject::operator bool() { return IsValid(); } + bool SBCommandReturnObject::IsValid() const { return m_opaque_up != nullptr; } const char *SBCommandReturnObject::GetOutput() { Index: source/API/SBCommunication.cpp =================================================================== --- source/API/SBCommunication.cpp +++ source/API/SBCommunication.cpp @@ -35,6 +35,8 @@ m_opaque_owned = false; } +SBCommunication::operator bool() { return IsValid(); } + bool SBCommunication::IsValid() const { return m_opaque != NULL; } bool SBCommunication::GetCloseOnEOF() { Index: source/API/SBCompileUnit.cpp =================================================================== --- source/API/SBCompileUnit.cpp +++ source/API/SBCompileUnit.cpp @@ -190,6 +190,8 @@ return lldb::eLanguageTypeUnknown; } +SBCompileUnit::operator bool() { return IsValid(); } + bool SBCompileUnit::IsValid() const { return m_opaque_ptr != NULL; } bool SBCompileUnit::operator==(const SBCompileUnit &rhs) const { Index: source/API/SBData.cpp =================================================================== --- source/API/SBData.cpp +++ source/API/SBData.cpp @@ -50,6 +50,8 @@ const lldb::DataExtractorSP &SBData::operator*() const { return m_opaque_sp; } +SBData::operator bool() { return IsValid(); } + bool SBData::IsValid() { return m_opaque_sp.get() != NULL; } uint8_t SBData::GetAddressByteSize() { Index: source/API/SBDebugger.cpp =================================================================== --- source/API/SBDebugger.cpp +++ source/API/SBDebugger.cpp @@ -236,6 +236,8 @@ ModuleList::RemoveOrphanSharedModules(mandatory); } +SBDebugger::operator bool() { return IsValid(); } + bool SBDebugger::IsValid() const { return m_opaque_sp.get() != nullptr; } void SBDebugger::SetAsync(bool b) { Index: source/API/SBDeclaration.cpp =================================================================== --- source/API/SBDeclaration.cpp +++ source/API/SBDeclaration.cpp @@ -48,6 +48,8 @@ SBDeclaration::~SBDeclaration() {} +SBDeclaration::operator bool() { return IsValid(); } + bool SBDeclaration::IsValid() const { return m_opaque_up.get() && m_opaque_up->IsValid(); } Index: source/API/SBError.cpp =================================================================== --- source/API/SBError.cpp +++ source/API/SBError.cpp @@ -136,6 +136,8 @@ return num_chars; } +SBError::operator bool() { return IsValid(); } + bool SBError::IsValid() const { return m_opaque_up != NULL; } void SBError::CreateIfNeeded() { Index: source/API/SBEvent.cpp =================================================================== --- source/API/SBEvent.cpp +++ source/API/SBEvent.cpp @@ -144,6 +144,8 @@ m_event_sp.reset(); } +SBEvent::operator bool() { return IsValid(); } + bool SBEvent::IsValid() const { // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() accessor. // See comments in SBEvent::get().... Index: source/API/SBFileSpec.cpp =================================================================== --- source/API/SBFileSpec.cpp +++ source/API/SBFileSpec.cpp @@ -49,6 +49,8 @@ return *this; } +SBFileSpec::operator bool() { return IsValid(); } + bool SBFileSpec::IsValid() const { return m_opaque_up->operator bool(); } bool SBFileSpec::Exists() const { Index: source/API/SBFrame.cpp =================================================================== --- source/API/SBFrame.cpp +++ source/API/SBFrame.cpp @@ -87,6 +87,8 @@ return m_opaque_sp->SetFrameSP(lldb_object_sp); } +SBFrame::operator bool() { return IsValid(); } + bool SBFrame::IsValid() 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,6 +37,8 @@ SBFunction::~SBFunction() { m_opaque_ptr = NULL; } +SBFunction::operator bool() { return IsValid(); } + bool SBFunction::IsValid() const { return m_opaque_ptr != NULL; } const char *SBFunction::GetName() const { Index: source/API/SBInstruction.cpp =================================================================== --- source/API/SBInstruction.cpp +++ source/API/SBInstruction.cpp @@ -83,6 +83,8 @@ SBInstruction::~SBInstruction() {} +SBInstruction::operator bool() { return IsValid(); } + bool SBInstruction::IsValid() { return m_opaque_sp && m_opaque_sp->IsValid(); } SBAddress SBInstruction::GetAddress() { Index: source/API/SBInstructionList.cpp =================================================================== --- source/API/SBInstructionList.cpp +++ source/API/SBInstructionList.cpp @@ -32,6 +32,8 @@ SBInstructionList::~SBInstructionList() {} +SBInstructionList::operator bool() { return IsValid(); } + bool SBInstructionList::IsValid() const { return m_opaque_sp.get() != NULL; } size_t SBInstructionList::GetSize() { Index: source/API/SBLineEntry.cpp =================================================================== --- source/API/SBLineEntry.cpp +++ source/API/SBLineEntry.cpp @@ -87,6 +87,8 @@ return sb_address; } +SBLineEntry::operator bool() { return IsValid(); } + bool SBLineEntry::IsValid() const { return m_opaque_up.get() && m_opaque_up->IsValid(); } Index: source/API/SBListener.cpp =================================================================== --- source/API/SBListener.cpp +++ source/API/SBListener.cpp @@ -47,6 +47,8 @@ SBListener::~SBListener() {} +SBListener::operator bool() { return IsValid(); } + bool SBListener::IsValid() const { return m_opaque_sp != nullptr; } void SBListener::AddEvent(const SBEvent &event) { Index: source/API/SBModule.cpp =================================================================== --- source/API/SBModule.cpp +++ source/API/SBModule.cpp @@ -66,6 +66,8 @@ SBModule::~SBModule() {} +SBModule::operator bool() { return IsValid(); } + bool SBModule::IsValid() 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,6 +30,8 @@ SBModuleSpec::~SBModuleSpec() {} +SBModuleSpec::operator bool() { return IsValid(); } + bool SBModuleSpec::IsValid() 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,6 +215,8 @@ SBPlatform::~SBPlatform() {} +SBPlatform::operator bool() { return IsValid(); } + bool SBPlatform::IsValid() 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,6 +96,8 @@ void SBProcess::Clear() { m_opaque_wp.reset(); } +SBProcess::operator bool() { return IsValid(); } + bool SBProcess::IsValid() 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,6 +45,8 @@ ref() = proc_info_ref; } +SBProcessInfo::operator bool() { return IsValid(); } + bool SBProcessInfo::IsValid() const { return m_opaque_up != nullptr; } const char *SBProcessInfo::GetName() { Index: source/API/SBQueue.cpp =================================================================== --- source/API/SBQueue.cpp +++ source/API/SBQueue.cpp @@ -250,6 +250,8 @@ SBQueue::~SBQueue() {} +SBQueue::operator bool() { return IsValid(); } + bool SBQueue::IsValid() const { bool is_valid = m_opaque_sp->IsValid(); Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBQueueItem.cpp =================================================================== --- source/API/SBQueueItem.cpp +++ source/API/SBQueueItem.cpp @@ -33,6 +33,8 @@ //---------------------------------------------------------------------- SBQueueItem::~SBQueueItem() { m_queue_item_sp.reset(); } +SBQueueItem::operator bool() { return IsValid(); } + bool SBQueueItem::IsValid() const { bool is_valid = m_queue_item_sp.get() != NULL; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: source/API/SBSection.cpp =================================================================== --- source/API/SBSection.cpp +++ source/API/SBSection.cpp @@ -39,6 +39,8 @@ SBSection::~SBSection() {} +SBSection::operator bool() { return IsValid(); } + bool SBSection::IsValid() 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,6 +24,8 @@ SBStream::~SBStream() {} +SBStream::operator bool() { return IsValid(); } + bool SBStream::IsValid() const { return (m_opaque_up != NULL); } // If this stream is not redirected to a file, it will maintain a local cache Index: source/API/SBStringList.cpp =================================================================== --- source/API/SBStringList.cpp +++ source/API/SBStringList.cpp @@ -46,6 +46,8 @@ return *m_opaque_up; } +SBStringList::operator bool() { return IsValid(); } + bool SBStringList::IsValid() const { return (m_opaque_up != NULL); } void SBStringList::AppendString(const char *str) { Index: source/API/SBStructuredData.cpp =================================================================== --- source/API/SBStructuredData.cpp +++ source/API/SBStructuredData.cpp @@ -54,6 +54,8 @@ return error; } +SBStructuredData::operator bool() { return IsValid(); } + bool SBStructuredData::IsValid() 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,6 +37,8 @@ m_opaque_ptr = lldb_object_ptr; } +SBSymbol::operator bool() { return IsValid(); } + bool SBSymbol::IsValid() const { return m_opaque_ptr != NULL; } const char *SBSymbol::GetName() const { Index: source/API/SBSymbolContext.cpp =================================================================== --- source/API/SBSymbolContext.cpp +++ source/API/SBSymbolContext.cpp @@ -55,6 +55,8 @@ } } +SBSymbolContext::operator bool() { return IsValid(); } + bool SBSymbolContext::IsValid() const { return m_opaque_up != NULL; } SBModule SBSymbolContext::GetModule() { Index: source/API/SBSymbolContextList.cpp =================================================================== --- source/API/SBSymbolContextList.cpp +++ source/API/SBSymbolContextList.cpp @@ -61,6 +61,8 @@ m_opaque_up->Append(*sc_list); } +SBSymbolContextList::operator bool() { return IsValid(); } + bool SBSymbolContextList::IsValid() const { return m_opaque_up != NULL; } lldb_private::SymbolContextList *SBSymbolContextList::operator->() const { Index: source/API/SBTarget.cpp =================================================================== --- source/API/SBTarget.cpp +++ source/API/SBTarget.cpp @@ -141,6 +141,8 @@ return Target::GetStaticBroadcasterClass().AsCString(); } +SBTarget::operator bool() { return IsValid(); } + bool SBTarget::IsValid() 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,6 +108,8 @@ return sb_queue; } +SBThread::operator bool() { return IsValid(); } + bool SBThread::IsValid() 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,6 +50,8 @@ return m_opaque_sp; } +SBThreadCollection::operator bool() { return IsValid(); } + bool SBThreadCollection::IsValid() const { return m_opaque_sp.get() != NULL; } size_t SBThreadCollection::GetSize() { 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(); } +SBThreadPlan::operator bool() { return IsValid(); } + bool SBThreadPlan::IsValid() const { return m_opaque_sp.get() != NULL; } void SBThreadPlan::Clear() { m_opaque_sp.reset(); } Index: source/API/SBTrace.cpp =================================================================== --- source/API/SBTrace.cpp +++ source/API/SBTrace.cpp @@ -101,6 +101,8 @@ void SBTrace::SetSP(const ProcessSP &process_sp) { m_opaque_wp = process_sp; } +SBTrace::operator bool() { return IsValid(); } + bool SBTrace::IsValid() { if (!m_trace_impl_sp) return false; Index: source/API/SBTraceOptions.cpp =================================================================== --- source/API/SBTraceOptions.cpp +++ source/API/SBTraceOptions.cpp @@ -77,6 +77,8 @@ m_traceoptions_sp->setMetaDataBufferSize(size); } +SBTraceOptions::operator bool() { return IsValid(); } + bool SBTraceOptions::IsValid() { if (m_traceoptions_sp) return true; Index: source/API/SBType.cpp =================================================================== --- source/API/SBType.cpp +++ source/API/SBType.cpp @@ -96,6 +96,8 @@ return *m_opaque_sp; } +SBType::operator bool() { return IsValid(); } + bool SBType::IsValid() const { if (m_opaque_sp.get() == NULL) return false; @@ -453,6 +455,8 @@ Append(const_cast(rhs).GetTypeAtIndex(i)); } +SBTypeList::operator bool() { return IsValid(); } + bool SBTypeList::IsValid() { return (m_opaque_up != NULL); } SBTypeList &SBTypeList::operator=(const SBTypeList &rhs) { @@ -499,6 +503,8 @@ return *this; } +SBTypeMember::operator bool() { return IsValid(); } + bool SBTypeMember::IsValid() const { return m_opaque_up.get(); } const char *SBTypeMember::GetName() { @@ -594,6 +600,8 @@ return *this; } +SBTypeMemberFunction::operator bool() { return IsValid(); } + bool SBTypeMemberFunction::IsValid() const { return m_opaque_sp.get(); } const char *SBTypeMemberFunction::GetName() { Index: source/API/SBTypeCategory.cpp =================================================================== --- source/API/SBTypeCategory.cpp +++ source/API/SBTypeCategory.cpp @@ -37,6 +37,8 @@ SBTypeCategory::~SBTypeCategory() {} +SBTypeCategory::operator bool() { return IsValid(); } + bool SBTypeCategory::IsValid() const { return (m_opaque_sp.get() != NULL); } bool SBTypeCategory::GetEnabled() { Index: source/API/SBTypeEnumMember.cpp =================================================================== --- source/API/SBTypeEnumMember.cpp +++ source/API/SBTypeEnumMember.cpp @@ -42,6 +42,8 @@ return *this; } +SBTypeEnumMember::operator bool() { return IsValid(); } + bool SBTypeEnumMember::IsValid() const { return m_opaque_sp.get(); } const char *SBTypeEnumMember::GetName() { @@ -95,6 +97,8 @@ Append(const_cast(rhs).GetTypeEnumMemberAtIndex(i)); } +SBTypeEnumMemberList::operator bool() { return IsValid(); } + bool SBTypeEnumMemberList::IsValid() { return (m_opaque_up != NULL); } SBTypeEnumMemberList &SBTypeEnumMemberList:: Index: source/API/SBTypeFilter.cpp =================================================================== --- source/API/SBTypeFilter.cpp +++ source/API/SBTypeFilter.cpp @@ -26,6 +26,8 @@ SBTypeFilter::~SBTypeFilter() {} +SBTypeFilter::operator bool() { return IsValid(); } + bool SBTypeFilter::IsValid() const { return m_opaque_sp.get() != NULL; } uint32_t SBTypeFilter::GetOptions() { Index: source/API/SBTypeFormat.cpp =================================================================== --- source/API/SBTypeFormat.cpp +++ source/API/SBTypeFormat.cpp @@ -31,6 +31,8 @@ SBTypeFormat::~SBTypeFormat() {} +SBTypeFormat::operator bool() { return IsValid(); } + bool SBTypeFormat::IsValid() const { return m_opaque_sp.get() != NULL; } lldb::Format SBTypeFormat::GetFormat() { Index: source/API/SBTypeNameSpecifier.cpp =================================================================== --- source/API/SBTypeNameSpecifier.cpp +++ source/API/SBTypeNameSpecifier.cpp @@ -36,6 +36,8 @@ SBTypeNameSpecifier::~SBTypeNameSpecifier() {} +SBTypeNameSpecifier::operator bool() { return IsValid(); } + bool SBTypeNameSpecifier::IsValid() const { return m_opaque_sp.get() != NULL; } const char *SBTypeNameSpecifier::GetName() { Index: source/API/SBTypeSummary.cpp =================================================================== --- source/API/SBTypeSummary.cpp +++ source/API/SBTypeSummary.cpp @@ -31,6 +31,8 @@ SBTypeSummaryOptions::~SBTypeSummaryOptions() {} +SBTypeSummaryOptions::operator bool() { return IsValid(); } + bool SBTypeSummaryOptions::IsValid() { return m_opaque_up.get(); } lldb::LanguageType SBTypeSummaryOptions::GetLanguage() { @@ -146,6 +148,8 @@ SBTypeSummary::~SBTypeSummary() {} +SBTypeSummary::operator bool() { return IsValid(); } + bool SBTypeSummary::IsValid() const { return m_opaque_sp.get() != NULL; } bool SBTypeSummary::IsFunctionCode() { Index: source/API/SBTypeSynthetic.cpp =================================================================== --- source/API/SBTypeSynthetic.cpp +++ source/API/SBTypeSynthetic.cpp @@ -41,6 +41,8 @@ SBTypeSynthetic::~SBTypeSynthetic() {} +SBTypeSynthetic::operator bool() { return IsValid(); } + bool SBTypeSynthetic::IsValid() const { return m_opaque_sp.get() != NULL; } bool SBTypeSynthetic::IsClassCode() { Index: source/API/SBUnixSignals.cpp =================================================================== --- source/API/SBUnixSignals.cpp +++ source/API/SBUnixSignals.cpp @@ -45,6 +45,8 @@ void SBUnixSignals::Clear() { m_opaque_wp.reset(); } +SBUnixSignals::operator bool() { return IsValid(); } + bool SBUnixSignals::IsValid() const { return static_cast(GetSP()); } const char *SBUnixSignals::GetSignalAsCString(int32_t signo) const { Index: source/API/SBValue.cpp =================================================================== --- source/API/SBValue.cpp +++ source/API/SBValue.cpp @@ -234,6 +234,8 @@ SBValue::~SBValue() {} +SBValue::operator bool() { return IsValid(); } + bool SBValue::IsValid() { // 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 Index: source/API/SBValueList.cpp =================================================================== --- source/API/SBValueList.cpp +++ source/API/SBValueList.cpp @@ -98,6 +98,8 @@ SBValueList::~SBValueList() {} +SBValueList::operator bool() { return IsValid(); } + bool SBValueList::IsValid() 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,6 +93,8 @@ SBVariablesOptions::~SBVariablesOptions() = default; +SBVariablesOptions::operator bool() { return IsValid(); } + bool SBVariablesOptions::IsValid() const { return m_opaque_up != nullptr; } bool SBVariablesOptions::GetIncludeArguments() const { Index: source/API/SBWatchpoint.cpp =================================================================== --- source/API/SBWatchpoint.cpp +++ source/API/SBWatchpoint.cpp @@ -69,6 +69,8 @@ return watch_id; } +SBWatchpoint::operator bool() { return IsValid(); } + bool SBWatchpoint::IsValid() const { return bool(m_opaque_wp.lock()); } SBError SBWatchpoint::GetError() {