MaskRay created this revision.
MaskRay added reviewers: labath, rupprecht.
Herald added a reviewer: shafik.
MaskRay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This fixes 6 check-lldb-shell failures in a `-DLLVM_USE_SANITIZER=Leaks` build.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100800
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
@@ -1226,6 +1226,7 @@
}
if (!function_decl) {
+ char *buf = nullptr;
llvm::StringRef name = attrs.name.GetStringRef();
// We currently generate function templates with template parameters in
@@ -1233,8 +1234,10 @@
// we want to strip these from the name when creating the AST.
if (attrs.mangled_name) {
llvm::ItaniumPartialDemangler D;
- if (!D.partialDemangle(attrs.mangled_name))
- name = D.getFunctionBaseName(nullptr, nullptr);
+ if (!D.partialDemangle(attrs.mangled_name)) {
+ buf = D.getFunctionBaseName(nullptr, nullptr);
+ name = buf;
+ }
}
// We just have a function that isn't part of a class
@@ -1243,6 +1246,7 @@
: containing_decl_ctx,
GetOwningClangModule(die), name, clang_type, attrs.storage,
attrs.is_inline);
+ free(buf);
if (has_template_params) {
TypeSystemClang::TemplateParameterInfos template_param_infos;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1226,6 +1226,7 @@
}
if (!function_decl) {
+ char *buf = nullptr;
llvm::StringRef name = attrs.name.GetStringRef();
// We currently generate function templates with template parameters in
@@ -1233,8 +1234,10 @@
// we want to strip these from the name when creating the AST.
if (attrs.mangled_name) {
llvm::ItaniumPartialDemangler D;
- if (!D.partialDemangle(attrs.mangled_name))
- name = D.getFunctionBaseName(nullptr, nullptr);
+ if (!D.partialDemangle(attrs.mangled_name)) {
+ buf = D.getFunctionBaseName(nullptr, nullptr);
+ name = buf;
+ }
}
// We just have a function that isn't part of a class
@@ -1243,6 +1246,7 @@
: containing_decl_ctx,
GetOwningClangModule(die), name, clang_type, attrs.storage,
attrs.is_inline);
+ free(buf);
if (has_template_params) {
TypeSystemClang::TemplateParameterInfos template_param_infos;
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits