Skip to content

Commit 3e27e98

Browse files
committed
fixup! adjust TypeSystemClang::DeclGetMangledName
1 parent 65f8706 commit 3e27e98

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
@@ -9045,6 +9045,21 @@ ConstString TypeSystemClang::DeclGetName(void *opaque_decl) {
90459045
return ConstString();
90469046
}
90479047

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

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

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

0 commit comments

Comments
 (0)