[Lldb-commits] [PATCH] D139649: [lldb] Make ParseTemplateParameterInfos return false if there are no template params
Arthur Eubanks via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 8 10:02:10 PST 2022
aeubanks created this revision.
Herald added a reviewer: shafik.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This factors out the check from various callers.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139649
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -747,9 +747,7 @@
clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE(die, nullptr);
TypeSystemClang::TemplateParameterInfos template_param_infos;
- if (ParseTemplateParameterInfos(die, template_param_infos) &&
- (!template_param_infos.args.empty() ||
- template_param_infos.packed_args)) {
+ if (ParseTemplateParameterInfos(die, template_param_infos)) {
// Most of the parameters here don't matter, but we make sure the base name
// is empty so when we print the name we only get the template parameters.
clang::ClassTemplateDecl *class_template_decl =
@@ -1247,20 +1245,23 @@
attrs.is_inline);
std::free(name_buf);
- if (has_template_params) {
+ {
TypeSystemClang::TemplateParameterInfos template_param_infos;
- ParseTemplateParameterInfos(die, template_param_infos);
- template_function_decl = m_ast.CreateFunctionDeclaration(
- ignore_containing_context ? m_ast.GetTranslationUnitDecl()
- : containing_decl_ctx,
- GetOwningClangModule(die), attrs.name.GetStringRef(), clang_type,
- attrs.storage, attrs.is_inline);
- clang::FunctionTemplateDecl *func_template_decl =
- m_ast.CreateFunctionTemplateDecl(
- containing_decl_ctx, GetOwningClangModule(die),
- template_function_decl, template_param_infos);
- m_ast.CreateFunctionTemplateSpecializationInfo(
- template_function_decl, func_template_decl, template_param_infos);
+ if (has_template_params &&
+ ParseTemplateParameterInfos(die, template_param_infos)) {
+ template_function_decl = m_ast.CreateFunctionDeclaration(
+ ignore_containing_context ? m_ast.GetTranslationUnitDecl()
+ : containing_decl_ctx,
+ GetOwningClangModule(die), attrs.name.GetStringRef(),
+ clang_type, attrs.storage, attrs.is_inline);
+ clang::FunctionTemplateDecl *func_template_decl =
+ m_ast.CreateFunctionTemplateDecl(
+ containing_decl_ctx, GetOwningClangModule(die),
+ template_function_decl, template_param_infos);
+ m_ast.CreateFunctionTemplateSpecializationInfo(
+ template_function_decl, func_template_decl,
+ template_param_infos);
+ }
}
lldbassert(function_decl);
@@ -1787,9 +1788,7 @@
metadata.SetIsDynamicCXXType(dwarf->ClassOrStructIsVirtual(die));
TypeSystemClang::TemplateParameterInfos template_param_infos;
- if (ParseTemplateParameterInfos(die, template_param_infos) &&
- (!template_param_infos.args.empty() ||
- template_param_infos.packed_args)) {
+ if (ParseTemplateParameterInfos(die, template_param_infos)) {
clang::ClassTemplateDecl *class_template_decl =
m_ast.ParseClassTemplateDecl(
decl_ctx, GetOwningClangModule(die), attrs.accessibility,
@@ -2123,7 +2122,10 @@
break;
}
}
- return template_param_infos.args.size() == template_param_infos.names.size();
+ return template_param_infos.args.size() ==
+ template_param_infos.names.size() &&
+ (!template_param_infos.args.empty() ||
+ template_param_infos.packed_args);
}
bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139649.481342.patch
Type: text/x-patch
Size: 3750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221208/56d28da2/attachment.bin>
More information about the lldb-commits
mailing list