[lldb] Remove FileSpec->CompileUnit inheritance
authorPavel Labath <pavel@labath.sk>
Thu, 28 Nov 2019 15:22:44 +0000 (16:22 +0100)
committerPavel Labath <pavel@labath.sk>
Fri, 29 Nov 2019 10:44:45 +0000 (11:44 +0100)
commit38870af8594726edf32aa0fd8fd9e8916df333af
tree27bb38c3c832da4ca89ffa31688c1d1056c722bb
parente478385e7708d0bcef43559651e6d62e387a507a
[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
22 files changed:
lldb/include/lldb/Symbol/CompileUnit.h
lldb/source/API/SBCompileUnit.cpp
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/source/Commands/CommandCompletions.cpp
lldb/source/Commands/CommandObjectSource.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Core/FileLineResolver.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Core/SourceManager.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/tools/lldb-test/lldb-test.cpp