Simplify ObjectFile::GetArchitecture

Summary:
instead of returning the architecture through by-ref argument and a
boolean value indicating success, we can just return the ArchSpec
directly. Since the ArchSpec already has an invalid state, it can be
used to denote the failure without the additional bool.

Reviewers: clayborg, zturner, espindola

Subscribers: emaste, arichardson, JDevlieghere, lldb-commits

Differential Revision: https://reviews.llvm.org/D56129

llvm-svn: 350291
This commit is contained in:
Pavel Labath
2019-01-03 10:37:19 +00:00
parent 4d752a88e8
commit f760f5aef4
25 changed files with 83 additions and 109 deletions

View File

@@ -153,8 +153,7 @@ void ObjectFileJIT::Dump(Stream *s) {
s->Indent();
s->PutCString("ObjectFileJIT");
ArchSpec arch;
if (GetArchitecture(arch))
if (ArchSpec arch = GetArchitecture())
*s << ", arch = " << arch.GetArchitectureName();
s->EOL();
@@ -190,11 +189,10 @@ ObjectFile::Type ObjectFileJIT::CalculateType() { return eTypeJIT; }
ObjectFile::Strata ObjectFileJIT::CalculateStrata() { return eStrataJIT; }
bool ObjectFileJIT::GetArchitecture(ArchSpec &arch) {
ObjectFileJITDelegateSP delegate_sp(m_delegate_wp.lock());
if (delegate_sp)
return delegate_sp->GetArchitecture(arch);
return false;
ArchSpec ObjectFileJIT::GetArchitecture() {
if (ObjectFileJITDelegateSP delegate_sp = m_delegate_wp.lock())
return delegate_sp->GetArchitecture();
return ArchSpec();
}
//------------------------------------------------------------------