[PATCH] D48241: [DebugInfo] Emit ObjC methods as part of interface.

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 15 15:27:45 PDT 2018


aprantl added a comment.

Thanks! Is there also a companion patch for LLVM that disables the objc accelerator table?

Note that this is not a 100% replacement of the apple_objc accelerator table, since the apple_objc table also lists all methods defined in categories of that interface. Is the idea to also add category methods into the interface's DW_TAG_struture_type?



================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3358
+    // Starting with DWARF5, we create declarations for the interface's
+    // methods.
+    if (const auto *OMD = dyn_cast_or_null<ObjCMethodDecl>(D)) {
----------------
`// Starting with DWARF V5 method declarations are emitted as children of the interface type.`


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4247
+
+      SmallVector<llvm::Metadata *, 16> EltTys;
+      for (auto *E : RealDecl->getElements()) {
----------------
`EltTys.append(RealDecl->getElements().begin(), RealDecl->getElements().end())`


================
Comment at: clang/lib/CodeGen/CGDebugInfo.h:105
+      llvm::DISubprogram *DIMethodDecl;
+      MethodData(const ObjCMethodDecl *MD, llvm::DISubprogram *DIMethodDecl)
+          : MD(MD), DIMethodDecl(DIMethodDecl) {}
----------------
This constructor is probably not necessary if you construct the struct as `{ MD, Decl }`?


================
Comment at: clang/lib/CodeGen/CGDebugInfo.h:111
+    // methods.
+    llvm::DICompositeType *DIInterfaceDecl;
+    std::vector<MethodData> Methods;
----------------
Isn't the interface already the key in the DenseMap?


================
Comment at: clang/test/CodeGenObjC/debug-info-synthesis.m:35
 
+// DWARF5: ![[STRUCT:.*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo"
 // CHECK: ![[FILE:.*]] = !DIFile(filename: "{{[^"]+}}foo.h"
----------------
We should also check that this does not happen in DWARF 4.


Repository:
  rC Clang

https://reviews.llvm.org/D48241





More information about the cfe-commits mailing list