This is an archive of the discontinued LLVM Phabricator instance.

[WIP][lldb] Add support for DW_AT_default_value in template params
AbandonedPublicDraft

Authored by Michael137 on Dec 15 2022, 11:45 AM.

Details

Diff Detail

Event Timeline

Michael137 created this revision.Dec 15 2022, 11:45 AM
Herald added a project: Restricted Project. · View Herald Transcript
Michael137 added inline comments.Dec 15 2022, 2:35 PM
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
428

Could instead change names into SmallVector<ArgumentInfo> where

struct ArgumentInfo {
    char const* name = nullptr;
    bool is_default = false;
};

So any future flags don't need to be separate vectors.

  • Fix API tests
Michael137 added inline comments.Dec 19 2022, 2:33 AM
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
1432

Problem is currently that LLDB currently can't reconstruct a generic ClassTemplateDecl from DWARF because we only have information about instantiations. Instead we re-use the decls we constructed from the first instantiation we encountered. With this patch we would set the ClassTemplateDecl default parameter to a concrete type which isn't quite correct because the TypePrinter asks the ClassTemplateDecl for the generic default parameter and checks the instantiations arguments for substitutability. So to make this work we either:

  1. Have to teach dwarf about generic parameters
  2. Store the fact that a template argument corresponds to a default value somewhere in Clang
  • Rebase on top of work-in-progress clang changes
Michael137 abandoned this revision.Jan 26 2023, 7:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2023, 7:40 AM