Replace 'ap' with 'up' suffix in variable names. (NFC)

The `ap` suffix is a remnant of lldb's former use of auto pointers,
before they got deprecated. Although all their uses were replaced by
unique pointers, some variables still carried the suffix.

In r353795 I removed another auto_ptr remnant, namely redundant calls to
::get for unique_pointers. Jim justly noted that this is a good
opportunity to clean up the variable names as well.

I went over all the changes to ensure my find-and-replace didn't have
any undesired side-effects. I hope I didn't miss any, but if you end up
at this commit doing a git blame on a weirdly named variable, please
know that the change was unintentional.

llvm-svn: 353912
This commit is contained in:
Jonas Devlieghere
2019-02-13 06:25:41 +00:00
parent 5cf777e413
commit d5b440369d
190 changed files with 1963 additions and 1959 deletions

View File

@@ -17,31 +17,31 @@
using namespace lldb;
using namespace lldb_private;
SBStream::SBStream() : m_opaque_ap(new StreamString()), m_is_file(false) {}
SBStream::SBStream() : m_opaque_up(new StreamString()), m_is_file(false) {}
SBStream::SBStream(SBStream &&rhs)
: m_opaque_ap(std::move(rhs.m_opaque_ap)), m_is_file(rhs.m_is_file) {}
: m_opaque_up(std::move(rhs.m_opaque_up)), m_is_file(rhs.m_is_file) {}
SBStream::~SBStream() {}
bool SBStream::IsValid() const { return (m_opaque_ap != NULL); }
bool SBStream::IsValid() 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.
const char *SBStream::GetData() {
if (m_is_file || m_opaque_ap == NULL)
if (m_is_file || m_opaque_up == NULL)
return NULL;
return static_cast<StreamString *>(m_opaque_ap.get())->GetData();
return static_cast<StreamString *>(m_opaque_up.get())->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 == NULL)
if (m_is_file || m_opaque_up == NULL)
return 0;
return static_cast<StreamString *>(m_opaque_ap.get())->GetSize();
return static_cast<StreamString *>(m_opaque_up.get())->GetSize();
}
void SBStream::Printf(const char *format, ...) {
@@ -58,11 +58,11 @@ void SBStream::RedirectToFile(const char *path, bool append) {
return;
std::string local_data;
if (m_opaque_ap) {
if (m_opaque_up) {
// 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)
local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
local_data = static_cast<StreamString *>(m_opaque_up.get())->GetString();
}
StreamFile *stream_file = new StreamFile;
uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
@@ -73,15 +73,15 @@ void SBStream::RedirectToFile(const char *path, bool append) {
FileSystem::Instance().Open(stream_file->GetFile(), FileSpec(path),
open_options);
m_opaque_ap.reset(stream_file);
m_opaque_up.reset(stream_file);
if (m_opaque_ap) {
if (m_opaque_up) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
// the to new file we are redirecting to.
if (!local_data.empty())
m_opaque_ap->Write(&local_data[0], local_data.size());
m_opaque_up->Write(&local_data[0], local_data.size());
} else
m_is_file = false;
}
@@ -91,63 +91,63 @@ void SBStream::RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership) {
return;
std::string local_data;
if (m_opaque_ap) {
if (m_opaque_up) {
// 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)
local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
local_data = static_cast<StreamString *>(m_opaque_up.get())->GetString();
}
m_opaque_ap.reset(new StreamFile(fh, transfer_fh_ownership));
m_opaque_up.reset(new StreamFile(fh, transfer_fh_ownership));
if (m_opaque_ap) {
if (m_opaque_up) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
// the to new file we are redirecting to.
if (!local_data.empty())
m_opaque_ap->Write(&local_data[0], local_data.size());
m_opaque_up->Write(&local_data[0], local_data.size());
} else
m_is_file = false;
}
void SBStream::RedirectToFileDescriptor(int fd, bool transfer_fh_ownership) {
std::string local_data;
if (m_opaque_ap) {
if (m_opaque_up) {
// 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)
local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
local_data = static_cast<StreamString *>(m_opaque_up.get())->GetString();
}
m_opaque_ap.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
if (m_opaque_ap) {
m_opaque_up.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
if (m_opaque_up) {
m_is_file = true;
// If we had any data locally in our StreamString, then pass that along to
// the to new file we are redirecting to.
if (!local_data.empty())
m_opaque_ap->Write(&local_data[0], local_data.size());
m_opaque_up->Write(&local_data[0], local_data.size());
} else
m_is_file = false;
}
lldb_private::Stream *SBStream::operator->() { return m_opaque_ap.get(); }
lldb_private::Stream *SBStream::operator->() { return m_opaque_up.get(); }
lldb_private::Stream *SBStream::get() { return m_opaque_ap.get(); }
lldb_private::Stream *SBStream::get() { return m_opaque_up.get(); }
lldb_private::Stream &SBStream::ref() {
if (m_opaque_ap == NULL)
m_opaque_ap.reset(new StreamString());
return *m_opaque_ap;
if (m_opaque_up == NULL)
m_opaque_up.reset(new StreamString());
return *m_opaque_up;
}
void SBStream::Clear() {
if (m_opaque_ap) {
if (m_opaque_up) {
// 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)
m_opaque_ap.reset();
m_opaque_up.reset();
else
static_cast<StreamString *>(m_opaque_ap.get())->Clear();
static_cast<StreamString *>(m_opaque_up.get())->Clear();
}
}