diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-11-28 16:22:44 +0100 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-11-29 11:44:45 +0100 |
| commit | 38870af8594726edf32aa0fd8fd9e8916df333af (patch) | |
| tree | 27bb38c3c832da4ca89ffa31688c1d1056c722bb /lldb/source/API | |
| parent | e478385e7708d0bcef43559651e6d62e387a507a (diff) | |
| download | bcm5719-llvm-38870af8594726edf32aa0fd8fd9e8916df333af.tar.gz bcm5719-llvm-38870af8594726edf32aa0fd8fd9e8916df333af.zip | |
[lldb] Remove FileSpec->CompileUnit inheritance
Summary:
CompileUnit is a complicated class. Having it be implicitly convertible
to a FileSpec makes reasoning about it even harder.
This patch replaces the inheritance by a simple member and an accessor
function. This avoid the need for casting in places where one needed to
force a CompileUnit to be treated as a FileSpec, and does not add much
verbosity elsewhere.
It also fixes a bug where we were wrongly comparing CompileUnit& and a
CompileUnit*, which compiled due to a combination of this inheritance
and the FileSpec*->FileSpec implicit constructor.
Reviewers: teemperor, JDevlieghere, jdoerfert
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70827
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBCompileUnit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp index 581bda36350..d52040d850a 100644 --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -50,7 +50,7 @@ SBFileSpec SBCompileUnit::GetFileSpec() const { SBFileSpec file_spec; if (m_opaque_ptr) - file_spec.SetFileSpec(*m_opaque_ptr); + file_spec.SetFileSpec(m_opaque_ptr->GetPrimaryFile()); return LLDB_RECORD_RESULT(file_spec); } @@ -106,7 +106,7 @@ uint32_t SBCompileUnit::FindLineEntryIndex(uint32_t start_idx, uint32_t line, if (inline_file_spec && inline_file_spec->IsValid()) file_spec = inline_file_spec->ref(); else - file_spec = *m_opaque_ptr; + file_spec = m_opaque_ptr->GetPrimaryFile(); index = m_opaque_ptr->FindLineEntry( start_idx, line, inline_file_spec ? inline_file_spec->get() : nullptr, |

