[all-commits] [llvm/llvm-project] ab6742: [lldb][NFC] Prevent slicing when converting DataEx...

Felipe de Azevedo Piovezan via All-commits all-commits at lists.llvm.org
Tue Jun 27 15:10:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ab674234c440ed27302f58eeccc612c83b32c43f
      https://github.com/llvm/llvm-project/commit/ab674234c440ed27302f58eeccc612c83b32c43f
  Author: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
  Date:   2023-06-27 (Tue, 27 Jun 2023)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

  Log Message:
  -----------
  [lldb][NFC] Prevent slicing when converting DataExtractors

LLDB's implementation of DWARFDataExtractor has a method that returns a
llvm::DWARFDataExtractor. In some cases, like DebugNamesDWARFIndex::Create, we
were passing an LLVM::DWARFDataExtractor to a function that expects a
LLVM:DataExtractor by value. This is causing slicing of the derived class.

While slicing is not inherently bad, it can be dangerous if the constructor of
the derived class mutates the base class in a way that leaves it in an invalid
state after slicing.

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




More information about the All-commits mailing list