[all-commits] [llvm/llvm-project] 38870a: [lldb] Remove FileSpec->CompileUnit inheritance

Pavel Labath via All-commits all-commits at lists.llvm.org
Fri Nov 29 02:42:59 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 38870af8594726edf32aa0fd8fd9e8916df333af
      https://github.com/llvm/llvm-project/commit/38870af8594726edf32aa0fd8fd9e8916df333af
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2019-11-29 (Fri, 29 Nov 2019)

  Changed paths:
    M lldb/include/lldb/Symbol/CompileUnit.h
    M lldb/source/API/SBCompileUnit.cpp
    M lldb/source/Breakpoint/Breakpoint.cpp
    M lldb/source/Breakpoint/BreakpointLocation.cpp
    M lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
    M lldb/source/Commands/CommandCompletions.cpp
    M lldb/source/Commands/CommandObjectSource.cpp
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Core/FileLineResolver.cpp
    M lldb/source/Core/FormatEntity.cpp
    M lldb/source/Core/Module.cpp
    M lldb/source/Core/SearchFilter.cpp
    M lldb/source/Core/SourceManager.cpp
    M lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
    M lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    M lldb/source/Symbol/CompileUnit.cpp
    M lldb/source/Symbol/Function.cpp
    M lldb/source/Symbol/SymbolContext.cpp
    M lldb/tools/lldb-test/lldb-test.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list