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

Carlos Alberto Enciso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 05:22:10 PST 2022


CarlosAlbertoEnciso added a comment.

| Owner          | What             | Tracked          |
| LVReaderHander | LVReader         | TheReaders       |
| LVReader       | Logical Elements | AllocatedObjects |
|

The raw pointers for the logical elements are stored in the `LVScope`: `Types`, `Symbols`, `Scopes`, `Lines`, etc.
The `AllocatedObjects` was introduced to record their smart pointers, to minimize the changes across the tool.

  // Creates a logical object and records it in the Reader.
  template <typename ObjectType> ObjectType *createObject() {
    std::unique_ptr<LVObject> ObjectSP = std::make_unique<ObjectType>();
    LVObject *Object = ObjectSP.get();
    AllocatedObjects.emplace_back(std::move(ObjectSP));
    return (ObjectType *)Object;
  }

`createObject` is use to create any logical element within the tool or in the unittests.


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