Skip to content

Commit b3f075d

Browse files
committed
fixup! adjust TypeSystemClang::DeclGetMangledName
1 parent 13a0eaf commit b3f075d

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9046,6 +9046,21 @@ ConstString TypeSystemClang::DeclGetName(void *opaque_decl) {
90469046
return ConstString();
90479047
}
90489048

9049+
static ConstString
9050+
ExtractMangledNameFromFunctionCallLabel(llvm::StringRef label) {
9051+
auto components_or_err = splitFunctionCallLabel(label);
9052+
if (!components_or_err) {
9053+
llvm::consumeError(components_or_err.takeError());
9054+
return {};
9055+
}
9056+
9057+
llvm::StringRef mangled = (*components_or_err)[0];
9058+
if (Mangled::IsMangledName(mangled))
9059+
return ConstString(mangled);
9060+
9061+
return {};
9062+
}
9063+
90499064
ConstString TypeSystemClang::DeclGetMangledName(void *opaque_decl) {
90509065
clang::NamedDecl *nd = llvm::dyn_cast_or_null<clang::NamedDecl>(
90519066
static_cast<clang::Decl *>(opaque_decl));
@@ -9057,14 +9072,12 @@ ConstString TypeSystemClang::DeclGetMangledName(void *opaque_decl) {
90579072
if (!mc || !mc->shouldMangleCXXName(nd))
90589073
return {};
90599074

9060-
// We have a LLDB FunctionCallLabel instead of an ordinary mangled name.
9075+
// We have an LLDB FunctionCallLabel instead of an ordinary mangled name.
90619076
// Extract the mangled name out of this label.
9062-
if (const auto *label = nd->getAttr<AsmLabelAttr>()) {
9063-
if (auto components_or_err = splitFunctionCallLabel(label->getLabel()))
9064-
return ConstString((*components_or_err)[0]);
9065-
else
9066-
llvm::consumeError(components_or_err.takeError());
9067-
}
9077+
if (const auto *label = nd->getAttr<AsmLabelAttr>())
9078+
if (ConstString mangled =
9079+
ExtractMangledNameFromFunctionCallLabel(label->getLabel()))
9080+
return mangled;
90689081

90699082
llvm::SmallVector<char, 1024> buf;
90709083
llvm::raw_svector_ostream llvm_ostrm(buf);

0 commit comments

Comments
 (0)