Otherwise we may be inserting a decl into a DeclContext that's not fully defined yet.
This simplifies/removes some clang AST node creation code. Instead, use
clang::printTemplateArgumentList().
Paths
| Differential D142413
[lldb] Don't create Clang AST nodes in GetDIEClassTemplateParams ClosedPublic Authored by aeubanks on Jan 23 2023, 3:47 PM.
Details Summary Otherwise we may be inserting a decl into a DeclContext that's not fully defined yet. This simplifies/removes some clang AST node creation code. Instead, use
Diff Detail
Event TimelineComment Actions there may be an alternate solution involving making some declarations into definitions (at all? earlier?), but I don't have that level of understanding of lldb
Comment Actions
One idea that came to mind is that instead of creating a dummy template decl in GetDIEClassTemplateParams, you could perhaps construct a clang::TemplateArgumentList from the TemplateArguments stored in TemplateParameterInfos and use the clang::printTemplateArgumentList to stringify the template arguments, passing it the printing-policy which is used in TypeSystemClang to print type-names in your current implementation.
aeubanks retitled this revision from [lldb] Don't create Clang AST nodes in GetCPlusPlusQualifiedName to [lldb] Don't create Clang AST nodes in GetDIEClassTemplateParams.Jan 24 2023, 2:55 PM Comment Actions
this worked perfectly and simplified a lot of code, thanks!
This revision is now accepted and ready to land.Jan 24 2023, 5:22 PM Closed by commit rG5dd7c16c3dcf: [lldb] Don't create Clang AST nodes in GetDIEClassTemplateParams (authored by aeubanks). · Explain WhyJan 24 2023, 7:14 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 491924 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/test/API/lang/cpp/nested-template/Makefile
lldb/test/API/lang/cpp/nested-template/TestNestedTemplate.py
lldb/test/API/lang/cpp/nested-template/main.cpp
|
Btw, what's guaranteeing that we don't call this more than once per DIE? Is there any way we could add a test that would notify us of that kind of regression? Or perhaps an assert somewhere in the DWARFASTParserClang?