[PATCH] D137933: [llvm-debuginfo-analyzer] 10 - Smart Pointers

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 09:03:17 PST 2022


dblaikie added a comment.

(pulling this discussion about new data structures out of line as I think it'll take more words/quoting/etc than are easy to do in inline comments)

>> There's a lot of code like this - Lines here, Children above, Ranges and Scopes below, etc - are they all needed, or could some of them be turned into direct values (eg: LVLines Lines rather than unique_ptr<LVLines> Lines?)?
>
> This is a good question. They are all needed.
> The reason to define Lines, Children, Ranges, Scopes, etc in that way is to keep the size of LVScope as small as possible.
>
>   struct LVLines {};
>   
>   class ClassPointer {
>     std::unique_ptr<SmallVector<LVLines *>> Lines;
>   };
>   
>   class ClassVector {
>    SmallVector<LVLines *,2> Lines; 
>   };
>
> ClassPointer size = 8 bytes
> ClassVector size = 32 bytes

Could you expand on this a bit - what's the current ownership model (before moving to smart pointers)? (which things are owned by what/tracked where - where are the raw pointers stored/what code is responsible for cleaning them up) Maybe take one of these lists as an example.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137933



More information about the llvm-commits mailing list