[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

@@ -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)