[Lldb-commits] [PATCH] D129807: [LLDB][NativePDB] Add MSInheritanceAttr when completing CXXRecordDecl
Zequan Wu via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 14 15:12:22 PDT 2022
zequanwu created this revision.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129807
Files:
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
Index: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
===================================================================
--- lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
@@ -57,6 +57,7 @@
llvm::DenseMap<lldb::opaque_compiler_type_t,
llvm::SmallSet<std::pair<llvm::StringRef, CompilerType>, 8>>
&m_cxx_record_map;
+ bool has_virtual_base = false;
public:
UdtRecordCompleter(
Index: lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
@@ -123,6 +123,7 @@
Error UdtRecordCompleter::visitKnownMember(CVMemberRecord &cvr,
VirtualBaseClassRecord &base) {
+ has_virtual_base = true;
AddBaseClassForTypeIndex(base.BaseType, base.getAccess(), base.VTableIndex);
return Error::success();
@@ -312,6 +313,17 @@
TypeSystemClang::CompleteTagDeclarationDefinition(m_derived_ct);
if (auto *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(&m_tag_decl)) {
+ clang::MSInheritanceAttr::Spelling spelling;
+ if (has_virtual_base)
+ spelling = clang::MSInheritanceAttr::Keyword_virtual_inheritance;
+ else if (bases.size() > 1)
+ spelling = clang::MSInheritanceAttr::Keyword_multiple_inheritance;
+ else
+ spelling = clang::MSInheritanceAttr::Keyword_single_inheritance;
+ clang::MSInheritanceAttr *inheritance_attr =
+ clang::MSInheritanceAttr::CreateImplicit(
+ m_ast_builder.clang().getASTContext(), spelling);
+ record_decl->addAttr(inheritance_attr);
m_ast_builder.importer().SetRecordLayout(record_decl, m_layout);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129807.444810.patch
Type: text/x-patch
Size: 1880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220714/abed41e0/attachment.bin>
More information about the lldb-commits
mailing list