[PATCH] D126883: [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 12:46:35 PDT 2022


avl added a comment.

In D126883#3568729 <https://reviews.llvm.org/D126883#3568729>, @JDevlieghere wrote:

> I missed the original discussion about templating the class. It seems like that issue can be solved with the same solution we have form something like SmallVector where we pass the generic base class `SmallVectorImpl` around. I think we should be able to do something similar here?

I.e. something like this:

  template <typename T>
  DwarfStringPoolEntryRef (
    MCSymbol *getSymbol() const;
    uint64_t getOffset() const;
    unsigned getIndex() const;
    StringRef getString() const;
    const DwarfStringPoolEntry &getEntry() const;
  )
  
  
  OwningDwarfStringPoolEntryRef : public DwarfStringPoolEntryRef<DwarfStringPoolEntry> (
  )
  
  NonOwningDwarfStringPoolEntryRef : public DwarfStringPoolEntryRef<DwarfStringPoolEntry*> (
  )
  
  
  template <typename DataT> class AccelTable : public AccelTableBase {
  public:
    template <typename EntryT, typename... Types>
    void addName(DwarfStringPoolEntryRef<EntryT>& Name, Types &&... Args);
  };
  
  template<typename T>
  class DIEString {
    DwarfStringPoolEntryRef<T>& S;
  
  }

?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126883



More information about the llvm-commits mailing list