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.


https://reviews.llvm.org/D85993

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


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->setHasWrittenPrototype(hasWrittenPrototype);
   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)
     decl_ctx->addDecl(func_decl);


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->setHasWrittenPrototype(hasWrittenPrototype);
   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)
     decl_ctx->addDecl(func_decl);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to