[Lldb-commits] [PATCH] D85993: [lldb] Set the access property on member function decls

Adrian McCarthy via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 14 13:24:53 PDT 2020

amccarth created this revision.
amccarth added reviewers: clayborg, aganea.
amccarth requested review of this revision.

This fixes two failures in the PDB tests.  LLVM has a "sanity" check on function decls.  One of the requirements of member functions is that they have the access property (public, protected, private) set if the function is a member function.  The check is an assert, so you'll see the failure only if you're running with assertions enabled.

This sets the access property to public to match how the existing code handles member function templates.



Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2017,6 +2017,12 @@
   func_decl->setConstexprKind(isConstexprSpecified ? CSK_constexpr
                                                    : CSK_unspecified);
+  // Functions inside a record need to have an access specifier.  It doesn't
+  // matter what access specifier we give the function as LLDB allows
+  // accessing everything inside a record.
+  if (decl_ctx->isRecord())
+    func_decl->setAccess(clang::AccessSpecifier::AS_public);
   SetOwningModule(func_decl, owning_module);
   if (func_decl)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85993.285748.patch
Type: text/x-patch
Size: 861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200814/ffee4238/attachment.bin>

More information about the lldb-commits mailing list