[PATCH] D115503: [DebugInfo] emit DW_AT_accessibility attribute for class/struct/union types.

Esme Yi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 10 02:55:43 PST 2021


Esme created this revision.
Esme added reviewers: shchenz, probinson, dblaikie, jhenderson, aprantl, PowerPC.
Herald added a subscriber: hiraditya.
Esme requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This patch emits DW_AT_accessibility attribute for class/struct/union types.

Sample program :

  class A {
    public:
      struct B {
      };
    public:
      B b;
  };
  
  struct C {
    private:
      union D {
      };
    public:
      D d;
  };
  
  union E {
    private:
      class F {
      };
      class G {
      };
    public:
      F f;
      G g;
  };

Debug info without this patch:

  0x0000013d:   DW_TAG_class_type
                  DW_AT_name      ("A")
  
  0x00000143:     DW_TAG_member
                    DW_AT_name    ("b")
                    DW_AT_accessibility   (DW_ACCESS_public)
  
  0x0000014e:     DW_TAG_structure_type
                    DW_AT_name    ("B") // no accessibility attribute is present, private access is assumed for B.
  
  0x00000155:   DW_TAG_structure_type
                  DW_AT_name      ("C")
  
  0x0000015b:     DW_TAG_member
                    DW_AT_name    ("d")
  
  0x00000165:     DW_TAG_union_type
                    DW_AT_name    ("D") // no accessibility attribute is present, public access is assumed for D.
  
  0x0000016c:   DW_TAG_union_type
                  DW_AT_name      ("E")
  
  0x00000172:     DW_TAG_member
                    DW_AT_name    ("f")
  
  0x0000017c:     DW_TAG_class_type
                    DW_AT_name    ("F") // no accessibility attribute is present, public access is assumed for F.
  
  0x00000182:     DW_TAG_member
                    DW_AT_name    ("g")
  
  0x0000018c:     DW_TAG_class_type
                    DW_AT_name    ("G") // no accessibility attribute is present, public access is assumed for G.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115503

Files:
  clang/include/clang/AST/DeclCXX.h
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGenCXX/debug-info-access.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/test/DebugInfo/X86/debug-info-access.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115503.393417.patch
Type: text/x-patch
Size: 18964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211210/7696f0e1/attachment-0001.bin>


More information about the cfe-commits mailing list