[all-commits] [llvm/llvm-project] 657672: [llvm][DebugInfo] Add DW_TAG_imported_declaration ...

Michael Buch via All-commits all-commits at lists.llvm.org
Thu Feb 9 17:34:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 657672667fd16aa49897093b925c93c900286c8d
      https://github.com/llvm/llvm-project/commit/657672667fd16aa49897093b925c93c900286c8d
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    A llvm/test/DebugInfo/Inputs/accel-imported-declaration.cpp
    A llvm/test/DebugInfo/Inputs/accel-imported-declaration.macho-arm64.o
    A llvm/test/DebugInfo/accel-imported-declaration.test

  Log Message:
  -----------
  [llvm][DebugInfo] Add DW_TAG_imported_declaration to accelerator tables

**Summary**

After this patch, `DW_TAG_imported_declaration`s will be emitted into
the DWARF accelerator tables (under `.apple_namespaces`)

**Motivation**

Currently LLDB expression evaluation doesn't see through namespace
aliases. This is because LLDB only considers namespaces that are
part of `.apple_namespaces` when building a nested namespace
identifier for C++, which currently doesn't include import
declarations. The alternative to putting imports into accelerator
tables is to do a linear scan of a `DW_TAG_namespace` and look
for import declarations that look like they would satisfy the lookup
request, which is prohibitively expensive.

**Testing**

* Added unit-test

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


  Commit: ccee9b7839a182fc692a65f563abf76f81dd436c
      https://github.com/llvm/llvm-project/commit/ccee9b7839a182fc692a65f563abf76f81dd436c
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M llvm/lib/DWARFLinker/DWARFLinker.cpp
    A llvm/test/tools/dsymutil/ARM/accel-imported-declarations.test
    A llvm/test/tools/dsymutil/Inputs/accel-imported-declaration.cpp
    A llvm/test/tools/dsymutil/Inputs/accel-imported-declaration.macho-arm64

  Log Message:
  -----------
  [llvm][dsymutil] Add DW_TAG_imported_declaration to accelerator table

**Summary**

After this patch, `dsymutil` will preserve `DW_TAG_imported_declarations`
entries in accelerator tables.

This allows consumers to resolve imported declarations even on
executables processsed through dsymutil.

This helps consumers, particularly LLDB's expression evaluator,
to resolve imported declarations (i.e., useful for namespace aliases
in C++) more efficiently.

**Testing**

* Added unit-test

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


  Commit: 1ba6ec0ba906472661506ef7bd2f0bf4efe4657e
      https://github.com/llvm/llvm-project/commit/1ba6ec0ba906472661506ef7bd2f0bf4efe4657e
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2023-02-10 (Fri, 10 Feb 2023)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
    A lldb/test/API/commands/expression/namespace-alias/Makefile
    A lldb/test/API/commands/expression/namespace-alias/TestInlineNamespaceAlias.py
    A lldb/test/API/commands/expression/namespace-alias/main.cpp

  Log Message:
  -----------
  [lldb][DWARFASTParserClang] Correctly resolve imported namespaces during expression evaluation

**Summary**

This patch makes the expression evaluator understand
namespace aliases.

This will become important once `std::ranges` become
more widespread since `std::views` is defined as:

```
namespace std {
namespace ranges::views {}

namespace views = ranges::views;
}
```

**Testing**

* Added API test

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


Compare: https://github.com/llvm/llvm-project/compare/8b6ae9bd7466...1ba6ec0ba906


More information about the All-commits mailing list