[PATCH] D137933: [llvm-debuginfo-analyzer] 08a - Memory Management

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 02:34:03 PST 2023


Orlando added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/LogicalView/Readers/LVBinaryReader.h:103
 
+  std::vector<std::unique_ptr<LVLines>> DiscoveredLines;
+
----------------
CarlosAlbertoEnciso wrote:
> Orlando wrote:
> > What benefit do we get from `std::vector<std::unique_ptr<LVLines>>` over `std::vector<LVLines>`? Are the elements compared by address?
> > 
> > EDIT: see comment later on asking if we actually need this container at all.
> To answer both questions, this is the logic behind the debug and assembler line processing:
> 
> In `createScopes` for each Compile Unit:
> - call `traverseDieAndChildren` to parse the debug info
> - Call `createLineAndFileRecords` that creates `LVLineDebug`s for each entry in the debug line section
> - call `createInstructions` that creates a vector of `LVLineAssembler` for the associated text section.
>   Its unique pointer is stored in `DiscoveredLines` and never updated.
>   Its raw pointer is stored in `ScopeInstructions`.
>   The `AssemblerMappings` is updated to record specific section index, current logical scope and text address.
> - call `addSectionRange` to collect all debug ranges
> - call `processLines` to allocate the collected lines (debug and assembler) to their logical scope.
>   It uses the `ScopeInstructions` to locate specific assembler lines using data from `AssemblerMappings`.
>   It moves lines (debug and assembler) to their logical scope.
> 
> At the end of the scopes creation, `DiscoveredLines` constains the unique pointers to empty vector.
>  It moves lines (debug and assembler) to their logical scope.

Where does this happen? I can't see any uses of `DiscoveredLines` in this patch other than where entries are added. Sorry if this is a silly question - just trying to get my head around this field still.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137933/new/

https://reviews.llvm.org/D137933



More information about the llvm-commits mailing list