[API] Remove redundants get() from smart pointers. NFC

Removes redundant calls to ::get() from smart pointers in the source/API
directory..

llvm-svn: 349821
This commit is contained in:
Jonas Devlieghere 2018-12-20 21:02:55 +00:00
parent 0a90d7c92b
commit 3447077a28
21 changed files with 97 additions and 104 deletions

View File

@ -62,7 +62,7 @@ bool lldb::operator==(const SBAddress &lhs, const SBAddress &rhs) {
}
bool SBAddress::IsValid() const {
return m_opaque_ap.get() != NULL && m_opaque_ap->IsValid();
return m_opaque_ap != NULL && m_opaque_ap->IsValid();
}
void SBAddress::Clear() { m_opaque_ap.reset(new Address()); }
@ -156,7 +156,7 @@ Address *SBAddress::operator->() { return m_opaque_ap.get(); }
const Address *SBAddress::operator->() const { return m_opaque_ap.get(); }
Address &SBAddress::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new Address());
return *m_opaque_ap;
}

View File

@ -164,11 +164,11 @@ const SBBreakpointName &SBBreakpointName::operator=(const SBBreakpointName &rhs)
}
bool SBBreakpointName::operator==(const lldb::SBBreakpointName &rhs) {
return *m_impl_up.get() == *rhs.m_impl_up.get();
return *m_impl_up == *rhs.m_impl_up;
}
bool SBBreakpointName::operator!=(const lldb::SBBreakpointName &rhs) {
return *m_impl_up.get() != *rhs.m_impl_up.get();
return *m_impl_up != *rhs.m_impl_up;
}
bool SBBreakpointName::IsValid() const {

View File

@ -98,7 +98,7 @@ SBCommandInterpreterRunOptions::get() const {
lldb_private::CommandInterpreterRunOptions &
SBCommandInterpreterRunOptions::ref() const {
return *m_opaque_up.get();
return *m_opaque_up;
}
class CommandPluginInterfaceImplementation : public CommandObjectParsed {

View File

@ -48,9 +48,7 @@ operator=(const SBCommandReturnObject &rhs) {
return *this;
}
bool SBCommandReturnObject::IsValid() const {
return m_opaque_ap.get() != nullptr;
}
bool SBCommandReturnObject::IsValid() const { return m_opaque_ap != nullptr; }
const char *SBCommandReturnObject::GetOutput() {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));

View File

@ -75,7 +75,7 @@ uint32_t SBDeclaration::GetLine() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
uint32_t line = 0;
if (m_opaque_ap.get())
if (m_opaque_ap)
line = m_opaque_ap->GetLine();
if (log)
@ -86,7 +86,7 @@ uint32_t SBDeclaration::GetLine() const {
}
uint32_t SBDeclaration::GetColumn() const {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetColumn();
return 0;
}
@ -126,7 +126,7 @@ const lldb_private::Declaration *SBDeclaration::operator->() const {
}
lldb_private::Declaration &SBDeclaration::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new lldb_private::Declaration());
return *m_opaque_ap;
}
@ -138,7 +138,7 @@ const lldb_private::Declaration &SBDeclaration::ref() const {
bool SBDeclaration::GetDescription(SBStream &description) {
Stream &strm = description.ref();
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
char file_path[PATH_MAX * 2];
m_opaque_ap->GetFile().GetPath(file_path, sizeof(file_path));
strm.Printf("%s:%u", file_path, GetLine());

View File

@ -28,7 +28,7 @@ SBError::~SBError() {}
const SBError &SBError::operator=(const SBError &rhs) {
if (rhs.IsValid()) {
if (m_opaque_ap.get())
if (m_opaque_ap)
*m_opaque_ap = *rhs;
else
m_opaque_ap.reset(new Status(*rhs));
@ -39,13 +39,13 @@ const SBError &SBError::operator=(const SBError &rhs) {
}
const char *SBError::GetCString() const {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->AsCString();
return NULL;
}
void SBError::Clear() {
if (m_opaque_ap.get())
if (m_opaque_ap)
m_opaque_ap->Clear();
}
@ -53,7 +53,7 @@ bool SBError::Fail() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
bool ret_value = false;
if (m_opaque_ap.get())
if (m_opaque_ap)
ret_value = m_opaque_ap->Fail();
if (log)
@ -66,7 +66,7 @@ bool SBError::Fail() const {
bool SBError::Success() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
bool ret_value = true;
if (m_opaque_ap.get())
if (m_opaque_ap)
ret_value = m_opaque_ap->Success();
if (log)
@ -80,7 +80,7 @@ uint32_t SBError::GetError() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
uint32_t err = 0;
if (m_opaque_ap.get())
if (m_opaque_ap)
err = m_opaque_ap->GetError();
if (log)
@ -93,7 +93,7 @@ uint32_t SBError::GetError() const {
ErrorType SBError::GetType() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
ErrorType err_type = eErrorTypeInvalid;
if (m_opaque_ap.get())
if (m_opaque_ap)
err_type = m_opaque_ap->GetType();
if (log)
@ -137,10 +137,10 @@ int SBError::SetErrorStringWithFormat(const char *format, ...) {
return num_chars;
}
bool SBError::IsValid() const { return m_opaque_ap.get() != NULL; }
bool SBError::IsValid() const { return m_opaque_ap != NULL; }
void SBError::CreateIfNeeded() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new Status());
}
@ -159,7 +159,7 @@ const lldb_private::Status &SBError::operator*() const {
}
bool SBError::GetDescription(SBStream &description) {
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
if (m_opaque_ap->Success())
description.Printf("success");
else {

View File

@ -148,12 +148,10 @@ const lldb_private::FileSpec *SBFileSpec::get() const {
}
const lldb_private::FileSpec &SBFileSpec::operator*() const {
return *m_opaque_ap.get();
return *m_opaque_ap;
}
const lldb_private::FileSpec &SBFileSpec::ref() const {
return *m_opaque_ap.get();
}
const lldb_private::FileSpec &SBFileSpec::ref() const { return *m_opaque_ap; }
void SBFileSpec::SetFileSpec(const lldb_private::FileSpec &fs) {
*m_opaque_ap = fs;

View File

@ -26,7 +26,7 @@ SBFileSpecList::SBFileSpecList() : m_opaque_ap(new FileSpecList()) {}
SBFileSpecList::SBFileSpecList(const SBFileSpecList &rhs) : m_opaque_ap() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
if (rhs.m_opaque_ap.get())
if (rhs.m_opaque_ap)
m_opaque_ap.reset(new FileSpecList(*(rhs.get())));
if (log) {
@ -78,17 +78,17 @@ const lldb_private::FileSpecList *SBFileSpecList::get() const {
}
const lldb_private::FileSpecList &SBFileSpecList::operator*() const {
return *m_opaque_ap.get();
return *m_opaque_ap;
}
const lldb_private::FileSpecList &SBFileSpecList::ref() const {
return *m_opaque_ap.get();
return *m_opaque_ap;
}
bool SBFileSpecList::GetDescription(SBStream &description) const {
Stream &strm = description.ref();
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
uint32_t num_files = m_opaque_ap->GetSize();
strm.Printf("%d files: ", num_files);
for (uint32_t i = 0; i < num_files; i++) {

View File

@ -50,7 +50,7 @@ SBLineEntry::~SBLineEntry() {}
SBAddress SBLineEntry::GetStartAddress() const {
SBAddress sb_address;
if (m_opaque_ap.get())
if (m_opaque_ap)
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
@ -70,7 +70,7 @@ SBAddress SBLineEntry::GetStartAddress() const {
SBAddress SBLineEntry::GetEndAddress() const {
SBAddress sb_address;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
}
@ -114,7 +114,7 @@ uint32_t SBLineEntry::GetLine() const {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
uint32_t line = 0;
if (m_opaque_ap.get())
if (m_opaque_ap)
line = m_opaque_ap->line;
if (log)
@ -125,7 +125,7 @@ uint32_t SBLineEntry::GetLine() const {
}
uint32_t SBLineEntry::GetColumn() const {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->column;
return 0;
}
@ -165,7 +165,7 @@ const lldb_private::LineEntry *SBLineEntry::operator->() const {
}
lldb_private::LineEntry &SBLineEntry::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new lldb_private::LineEntry());
return *m_opaque_ap;
}
@ -175,7 +175,7 @@ const lldb_private::LineEntry &SBLineEntry::ref() const { return *m_opaque_ap; }
bool SBLineEntry::GetDescription(SBStream &description) {
Stream &strm = description.ref();
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
char file_path[PATH_MAX * 2];
m_opaque_ap->file.GetPath(file_path, sizeof(file_path));
strm.Printf("%s:%u", file_path, GetLine());

View File

@ -129,5 +129,5 @@ const MemoryRegionInfoListImpl *SBMemoryRegionInfoList::operator->() const {
const MemoryRegionInfoListImpl &SBMemoryRegionInfoList::operator*() const {
assert(m_opaque_ap.get());
return *m_opaque_ap.get();
return *m_opaque_ap;
}

View File

@ -36,7 +36,7 @@ SBProcessInfo &SBProcessInfo::operator=(const SBProcessInfo &rhs) {
}
ProcessInstanceInfo &SBProcessInfo::ref() {
if (m_opaque_ap.get() == nullptr) {
if (m_opaque_ap == nullptr) {
m_opaque_ap.reset(new ProcessInstanceInfo());
}
return *m_opaque_ap;
@ -46,7 +46,7 @@ void SBProcessInfo::SetProcessInfo(const ProcessInstanceInfo &proc_info_ref) {
ref() = proc_info_ref;
}
bool SBProcessInfo::IsValid() const { return m_opaque_ap.get() != nullptr; }
bool SBProcessInfo::IsValid() const { return m_opaque_ap != nullptr; }
const char *SBProcessInfo::GetName() {
const char *name = nullptr;

View File

@ -107,7 +107,7 @@ size_t SBSourceManager::DisplaySourceLinesWithLineNumbersAndColumn(
const SBFileSpec &file, uint32_t line, uint32_t column,
uint32_t context_before, uint32_t context_after,
const char *current_line_cstr, SBStream &s) {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
return 0;
return m_opaque_ap->DisplaySourceLinesWithLineNumbers(

View File

@ -25,12 +25,12 @@ SBStream::SBStream(SBStream &&rhs)
SBStream::~SBStream() {}
bool SBStream::IsValid() const { return (m_opaque_ap.get() != NULL); }
bool SBStream::IsValid() const { return (m_opaque_ap != 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.
const char *SBStream::GetData() {
if (m_is_file || m_opaque_ap.get() == NULL)
if (m_is_file || m_opaque_ap == NULL)
return NULL;
return static_cast<StreamString *>(m_opaque_ap.get())->GetData();
@ -39,7 +39,7 @@ const char *SBStream::GetData() {
// If this stream is not redirected to a file, it will maintain a local cache
// for the stream output whose length can be accessed using this accessor.
size_t SBStream::GetSize() {
if (m_is_file || m_opaque_ap.get() == NULL)
if (m_is_file || m_opaque_ap == NULL)
return 0;
return static_cast<StreamString *>(m_opaque_ap.get())->GetSize();
@ -59,7 +59,7 @@ void SBStream::RedirectToFile(const char *path, bool append) {
return;
std::string local_data;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@ -76,7 +76,7 @@ void SBStream::RedirectToFile(const char *path, bool append) {
open_options);
m_opaque_ap.reset(stream_file);
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@ -92,7 +92,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
return;
std::string local_data;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@ -100,7 +100,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
}
m_opaque_ap.reset(new StreamFile(fh, transfer_fh_ownership));
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@ -113,7 +113,7 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
void SBStream::RedirectToFileDescriptor(int fd, bool transfer_fh_ownership) {
std::string local_data;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (!m_is_file)
@ -121,7 +121,7 @@ void SBStream::RedirectToFileDescriptor(int fd, bool transfer_fh_ownership) {
}
m_opaque_ap.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
@ -137,13 +137,13 @@ lldb_private::Stream *SBStream::operator->() { return m_opaque_ap.get(); }
lldb_private::Stream *SBStream::get() { return m_opaque_ap.get(); }
lldb_private::Stream &SBStream::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new StreamString());
return *m_opaque_ap.get();
return *m_opaque_ap;
}
void SBStream::Clear() {
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
// See if we have any locally backed data. If so, copy it so we can then
// redirect it to the file so we don't lose the data
if (m_is_file)

View File

@ -47,7 +47,7 @@ const lldb_private::StringList &SBStringList::operator*() const {
return *m_opaque_ap;
}
bool SBStringList::IsValid() const { return (m_opaque_ap.get() != NULL); }
bool SBStringList::IsValid() const { return (m_opaque_ap != NULL); }
void SBStringList::AppendString(const char *str) {
if (str != NULL) {

View File

@ -27,7 +27,7 @@ SBSymbolContext::SBSymbolContext(const SymbolContext *sc_ptr) : m_opaque_ap() {
SBSymbolContext::SBSymbolContext(const SBSymbolContext &rhs) : m_opaque_ap() {
if (rhs.IsValid()) {
if (m_opaque_ap.get())
if (m_opaque_ap)
*m_opaque_ap = *rhs.m_opaque_ap;
else
ref() = *rhs.m_opaque_ap;
@ -39,32 +39,31 @@ SBSymbolContext::~SBSymbolContext() {}
const SBSymbolContext &SBSymbolContext::operator=(const SBSymbolContext &rhs) {
if (this != &rhs) {
if (rhs.IsValid())
m_opaque_ap.reset(
new lldb_private::SymbolContext(*rhs.m_opaque_ap.get()));
m_opaque_ap.reset(new lldb_private::SymbolContext(*rhs.m_opaque_ap));
}
return *this;
}
void SBSymbolContext::SetSymbolContext(const SymbolContext *sc_ptr) {
if (sc_ptr) {
if (m_opaque_ap.get())
if (m_opaque_ap)
*m_opaque_ap = *sc_ptr;
else
m_opaque_ap.reset(new SymbolContext(*sc_ptr));
} else {
if (m_opaque_ap.get())
if (m_opaque_ap)
m_opaque_ap->Clear(true);
}
}
bool SBSymbolContext::IsValid() const { return m_opaque_ap.get() != NULL; }
bool SBSymbolContext::IsValid() const { return m_opaque_ap != NULL; }
SBModule SBSymbolContext::GetModule() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
SBModule sb_module;
ModuleSP module_sp;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
module_sp = m_opaque_ap->module_sp;
sb_module.SetSP(module_sp);
}
@ -81,7 +80,7 @@ SBModule SBSymbolContext::GetModule() {
}
SBCompileUnit SBSymbolContext::GetCompileUnit() {
return SBCompileUnit(m_opaque_ap.get() ? m_opaque_ap->comp_unit : NULL);
return SBCompileUnit(m_opaque_ap ? m_opaque_ap->comp_unit : NULL);
}
SBFunction SBSymbolContext::GetFunction() {
@ -89,7 +88,7 @@ SBFunction SBSymbolContext::GetFunction() {
Function *function = NULL;
if (m_opaque_ap.get())
if (m_opaque_ap)
function = m_opaque_ap->function;
SBFunction sb_function(function);
@ -103,14 +102,14 @@ SBFunction SBSymbolContext::GetFunction() {
}
SBBlock SBSymbolContext::GetBlock() {
return SBBlock(m_opaque_ap.get() ? m_opaque_ap->block : NULL);
return SBBlock(m_opaque_ap ? m_opaque_ap->block : NULL);
}
SBLineEntry SBSymbolContext::GetLineEntry() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
if (m_opaque_ap.get())
if (m_opaque_ap)
sb_line_entry.SetLineEntry(m_opaque_ap->line_entry);
if (log) {
@ -127,7 +126,7 @@ SBSymbol SBSymbolContext::GetSymbol() {
Symbol *symbol = NULL;
if (m_opaque_ap.get())
if (m_opaque_ap)
symbol = m_opaque_ap->symbol;
SBSymbol sb_symbol(symbol);
@ -173,19 +172,19 @@ lldb_private::SymbolContext *SBSymbolContext::operator->() const {
const lldb_private::SymbolContext &SBSymbolContext::operator*() const {
assert(m_opaque_ap.get());
return *m_opaque_ap.get();
return *m_opaque_ap;
}
lldb_private::SymbolContext &SBSymbolContext::operator*() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new SymbolContext);
return *m_opaque_ap.get();
return *m_opaque_ap;
}
lldb_private::SymbolContext &SBSymbolContext::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new SymbolContext);
return *m_opaque_ap.get();
return *m_opaque_ap;
}
lldb_private::SymbolContext *SBSymbolContext::get() const {
@ -195,7 +194,7 @@ lldb_private::SymbolContext *SBSymbolContext::get() const {
bool SBSymbolContext::GetDescription(SBStream &description) {
Stream &strm = description.ref();
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
m_opaque_ap->GetDescription(&strm, lldb::eDescriptionLevelFull, NULL);
} else
strm.PutCString("No value");

View File

@ -31,14 +31,14 @@ operator=(const SBSymbolContextList &rhs) {
}
uint32_t SBSymbolContextList::GetSize() const {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetSize();
return 0;
}
SBSymbolContext SBSymbolContextList::GetContextAtIndex(uint32_t idx) {
SBSymbolContext sb_sc;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
SymbolContext sc;
if (m_opaque_ap->GetContextAtIndex(idx, sc)) {
sb_sc.SetSymbolContext(&sc);
@ -48,7 +48,7 @@ SBSymbolContext SBSymbolContextList::GetContextAtIndex(uint32_t idx) {
}
void SBSymbolContextList::Clear() {
if (m_opaque_ap.get())
if (m_opaque_ap)
m_opaque_ap->Clear();
}
@ -62,7 +62,7 @@ void SBSymbolContextList::Append(SBSymbolContextList &sc_list) {
m_opaque_ap->Append(*sc_list);
}
bool SBSymbolContextList::IsValid() const { return m_opaque_ap.get() != NULL; }
bool SBSymbolContextList::IsValid() const { return m_opaque_ap != NULL; }
lldb_private::SymbolContextList *SBSymbolContextList::operator->() const {
return m_opaque_ap.get();
@ -70,12 +70,12 @@ lldb_private::SymbolContextList *SBSymbolContextList::operator->() const {
lldb_private::SymbolContextList &SBSymbolContextList::operator*() const {
assert(m_opaque_ap.get());
return *m_opaque_ap.get();
return *m_opaque_ap;
}
bool SBSymbolContextList::GetDescription(lldb::SBStream &description) {
Stream &strm = description.ref();
if (m_opaque_ap.get())
if (m_opaque_ap)
m_opaque_ap->GetDescription(&strm, lldb::eDescriptionLevelFull, NULL);
return true;
}

View File

@ -451,7 +451,7 @@ SBTypeList::SBTypeList(const SBTypeList &rhs)
Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
}
bool SBTypeList::IsValid() { return (m_opaque_ap.get() != NULL); }
bool SBTypeList::IsValid() { return (m_opaque_ap != NULL); }
SBTypeList &SBTypeList::operator=(const SBTypeList &rhs) {
if (this != &rhs) {
@ -469,7 +469,7 @@ void SBTypeList::Append(SBType type) {
}
SBType SBTypeList::GetTypeAtIndex(uint32_t index) {
if (m_opaque_ap.get())
if (m_opaque_ap)
return SBType(m_opaque_ap->GetTypeAtIndex(index));
return SBType();
}
@ -500,39 +500,39 @@ lldb::SBTypeMember &SBTypeMember::operator=(const lldb::SBTypeMember &rhs) {
bool SBTypeMember::IsValid() const { return m_opaque_ap.get(); }
const char *SBTypeMember::GetName() {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetName().GetCString();
return NULL;
}
SBType SBTypeMember::GetType() {
SBType sb_type;
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
sb_type.SetSP(m_opaque_ap->GetTypeImpl());
}
return sb_type;
}
uint64_t SBTypeMember::GetOffsetInBytes() {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetBitOffset() / 8u;
return 0;
}
uint64_t SBTypeMember::GetOffsetInBits() {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetBitOffset();
return 0;
}
bool SBTypeMember::IsBitfield() {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetIsBitfield();
return false;
}
uint32_t SBTypeMember::GetBitfieldSizeInBits() {
if (m_opaque_ap.get())
if (m_opaque_ap)
return m_opaque_ap->GetBitfieldBitSize();
return 0;
}
@ -541,7 +541,7 @@ bool SBTypeMember::GetDescription(lldb::SBStream &description,
lldb::DescriptionLevel description_level) {
Stream &strm = description.ref();
if (m_opaque_ap.get()) {
if (m_opaque_ap) {
const uint32_t bit_offset = m_opaque_ap->GetBitOffset();
const uint32_t byte_offset = bit_offset / 8u;
const uint32_t byte_bit_offset = bit_offset % 8u;
@ -571,12 +571,12 @@ void SBTypeMember::reset(TypeMemberImpl *type_member_impl) {
}
TypeMemberImpl &SBTypeMember::ref() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new TypeMemberImpl());
return *m_opaque_ap.get();
return *m_opaque_ap;
}
const TypeMemberImpl &SBTypeMember::ref() const { return *m_opaque_ap.get(); }
const TypeMemberImpl &SBTypeMember::ref() const { return *m_opaque_ap; }
SBTypeMemberFunction::SBTypeMemberFunction() : m_opaque_sp() {}

View File

@ -94,7 +94,7 @@ SBTypeEnumMemberList::SBTypeEnumMemberList(const SBTypeEnumMemberList &rhs)
Append(const_cast<SBTypeEnumMemberList &>(rhs).GetTypeEnumMemberAtIndex(i));
}
bool SBTypeEnumMemberList::IsValid() { return (m_opaque_ap.get() != NULL); }
bool SBTypeEnumMemberList::IsValid() { return (m_opaque_ap != NULL); }
SBTypeEnumMemberList &SBTypeEnumMemberList::
operator=(const SBTypeEnumMemberList &rhs) {
@ -116,7 +116,7 @@ void SBTypeEnumMemberList::Append(SBTypeEnumMember enum_member) {
SBTypeEnumMember
SBTypeEnumMemberList::GetTypeEnumMemberAtIndex(uint32_t index) {
if (m_opaque_ap.get())
if (m_opaque_ap)
return SBTypeEnumMember(m_opaque_ap->GetTypeEnumMemberAtIndex(index));
return SBTypeEnumMember();
}

View File

@ -25,7 +25,7 @@ SBTypeSummaryOptions::SBTypeSummaryOptions() {
SBTypeSummaryOptions::SBTypeSummaryOptions(
const lldb::SBTypeSummaryOptions &rhs) {
if (rhs.m_opaque_ap)
m_opaque_ap.reset(new TypeSummaryOptions(*rhs.m_opaque_ap.get()));
m_opaque_ap.reset(new TypeSummaryOptions(*rhs.m_opaque_ap));
else
m_opaque_ap.reset(new TypeSummaryOptions());
}
@ -70,11 +70,11 @@ lldb_private::TypeSummaryOptions *SBTypeSummaryOptions::get() {
}
lldb_private::TypeSummaryOptions &SBTypeSummaryOptions::ref() {
return *m_opaque_ap.get();
return *m_opaque_ap;
}
const lldb_private::TypeSummaryOptions &SBTypeSummaryOptions::ref() const {
return *m_opaque_ap.get();
return *m_opaque_ap;
}
SBTypeSummaryOptions::SBTypeSummaryOptions(

View File

@ -99,7 +99,7 @@ SBValueList::SBValueList(const ValueListImpl *lldb_object_ptr) : m_opaque_ap() {
SBValueList::~SBValueList() {}
bool SBValueList::IsValid() const { return (m_opaque_ap.get() != NULL); }
bool SBValueList::IsValid() const { return (m_opaque_ap != NULL); }
void SBValueList::Clear() { m_opaque_ap.reset(); }
@ -150,7 +150,7 @@ SBValue SBValueList::GetValueAtIndex(uint32_t idx) const {
// idx);
SBValue sb_value;
if (m_opaque_ap.get())
if (m_opaque_ap)
sb_value = m_opaque_ap->GetValueAtIndex(idx);
if (log) {
@ -172,7 +172,7 @@ uint32_t SBValueList::GetSize() const {
// log->Printf ("SBValueList::GetSize ()");
uint32_t size = 0;
if (m_opaque_ap.get())
if (m_opaque_ap)
size = m_opaque_ap->GetSize();
if (log)
@ -183,20 +183,20 @@ uint32_t SBValueList::GetSize() const {
}
void SBValueList::CreateIfNeeded() {
if (m_opaque_ap.get() == NULL)
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new ValueListImpl());
}
SBValue SBValueList::FindValueObjectByUID(lldb::user_id_t uid) {
SBValue sb_value;
if (m_opaque_ap.get())
if (m_opaque_ap)
sb_value = m_opaque_ap->FindValueByUID(uid);
return sb_value;
}
SBValue SBValueList::GetFirstValueByName(const char *name) const {
SBValue sb_value;
if (m_opaque_ap.get())
if (m_opaque_ap)
sb_value = m_opaque_ap->GetFirstValueByName(name);
return sb_value;
}
@ -205,5 +205,5 @@ void *SBValueList::opaque_ptr() { return m_opaque_ap.get(); }
ValueListImpl &SBValueList::ref() {
CreateIfNeeded();
return *m_opaque_ap.get();
return *m_opaque_ap;
}

View File

@ -87,9 +87,7 @@ operator=(const SBVariablesOptions &options) {
SBVariablesOptions::~SBVariablesOptions() = default;
bool SBVariablesOptions::IsValid() const {
return m_opaque_ap.get() != nullptr;
}
bool SBVariablesOptions::IsValid() const { return m_opaque_ap != nullptr; }
bool SBVariablesOptions::GetIncludeArguments() const {
return m_opaque_ap->GetIncludeArguments();