[ObjC][DWARF] Emit DW_AT_APPLE_objc_direct for methods marked as __attribute__…

Authored by teemperor on Dec 17 2019, 12:36 AM.


[ObjC][DWARF] Emit DW_AT_APPLE_objc_direct for methods marked as attribute((objc_direct))

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