[all-commits] [llvm/llvm-project] ccfab8: [ObjC][DWARF] Emit DW_AT_APPLE_objc_direct for met...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Dec 17 00:41:09 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ccfab8e4596e59c8eea6b3610cd163c5d0312193
      https://github.com/llvm/llvm-project/commit/ccfab8e4596e59c8eea6b3610cd163c5d0312193
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2019-12-17 (Tue, 17 Dec 2019)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/test/CodeGenObjC/debug-info-direct-method.m
    M llvm/include/llvm/BinaryFormat/Dwarf.def
    M llvm/include/llvm/IR/DebugInfoFlags.def
    M llvm/include/llvm/IR/DebugInfoMetadata.h
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    A llvm/test/DebugInfo/X86/objc_direct.ll

  Log Message:
  -----------
  [ObjC][DWARF] Emit DW_AT_APPLE_objc_direct for methods marked as __attribute__((objc_direct))

Summary:
With DWARF5 it is no longer possible to distinguish normal methods and methods with `__attribute__((objc_direct))` by just looking at the debug information
as they are both now children of the of the DW_TAG_structure_type that defines them (before only the `__attribute__((objc_direct))` methods were children).

This means that in LLDB we are no longer able to create a correct Clang AST of a module by just looking at the debug information. Instead we would
need to call the Objective-C runtime to see which of the methods have a `__attribute__((objc_direct))` and then add the attribute to our own Clang AST
depending on what the runtime returns. This would mean that we either let the module AST be dependent on the Objective-C runtime (which doesn't
seem right) or we retroactively add the missing attribute to the imported AST in our expressions.

A third option is to annotate methods with `__attribute__((objc_direct))` as `DW_AT_APPLE_objc_direct` which is what this patch implements. This way
LLDB doesn't have to call the runtime for any `__attribute__((objc_direct))` method and the AST in our module will already be correct when we create it.

Reviewers: aprantl, SouraVX

Reviewed By: aprantl

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm, #debug-info

Differential Revision: https://reviews.llvm.org/D71201




More information about the All-commits mailing list