llvm with tablegen backend for capstone disassembler
Go to file
Michael Buch 711a644127 [clang][DebugInfo] Emit DW_AT_type of preferred name if available
With this patch, whenever we emit a `DW_AT_type` for some declaration
and the type is a template class with a `clang::PreferredNameAttr`, we
will emit the typedef that the attribute refers to instead. I.e.,

```
0x123 DW_TAG_variable
        DW_AT_name "var"
        DW_AT_type (0x123 "basic_string<char>")

0x124 DW_TAG_structure_type
        DW_AT_name "basic_string<char>"
```
...becomes
```
0x123 DW_TAG_variable
        DW_AT_name "var"
        DW_AT_type (0x124 "std::string")

0x124 DW_TAG_structure_type
        DW_AT_name "basic_string<char>"

0x125 DW_TAG_typedef
        DW_AT_name "std::string"
        DW_AT_type (0x124 "basic_string<char>")
```

We do this by returning the preferred name typedef `DIType` when
we create a structure definition. In some cases, e.g., with `-gmodules`,
we don't complete the structure definition immediately but do so later
via `completeClassData`, which overwrites the `TypeCache`. In such cases
we don't actually want to rewrite the cache with the preferred name. We
handle this by returning both the definition and the preferred typedef
from `CreateTypeDefinition` and let the callee decide what to do with
it.

Essentially we set up the types as:
```
TypeCache[Record] => DICompositeType
ReplaceMap[Record] => DIDerivedType(baseType: DICompositeType)
```

For now we keep this behind LLDB tuning.

**Testing**

- Added clang unit-test
- `check-llvm`, `check-clang` pass
- Confirmed that this change correctly repoints
  `basic_string` references in some of my test programs.
- Will add follow-up LLDB API tests

Differential Revision: https://reviews.llvm.org/D145803
2023-04-07 01:37:36 +01:00
.github workflows/release-tasks: Fix missing suffix on doxygen tarballs 2023-03-27 23:28:18 -07:00
bolt [MC] Always encode instruction into SmallVector 2023-04-06 16:21:49 +02:00
clang [clang][DebugInfo] Emit DW_AT_type of preferred name if available 2023-04-07 01:37:36 +01:00
clang-tools-extra [clang-tidy] Fix init-list handling in readability-implicit-bool-conversion 2023-04-05 10:22:10 +00:00
cmake Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag" 2023-03-28 08:28:17 +00:00
compiler-rt [ORC-RT] Fix testcase after 4c7f53b99c. 2023-04-06 17:02:16 -07:00
cross-project-tests [Dexter] Add timeout options 2023-03-22 13:50:00 +00:00
flang [flang][NFC] Update polymorphic design document to reflect implementation 2023-04-06 08:43:07 -07:00
libc [libc] Add strxfrm Implementation 2023-04-07 00:09:22 +00:00
libclc Revert "Reland "[CMake] Bumps minimum version to 3.20.0."" 2023-03-18 20:32:43 +01:00
libcxx [libc++][spaceship[NFC] P1614R2 operator<=> moves misplaced tests to correct location 2023-04-01 10:25:30 +03:00
libcxxabi [libcxxabi, libunwind] [test] Quote the python path properly for LIB*_EXECUTOR 2023-04-06 11:07:41 +03:00
libunwind [libunwind] [test] Add a mingw specific test config file 2023-04-06 11:07:41 +03:00
lld [lld-macho] Add new -reproducible flag 2023-04-06 09:59:53 -07:00
lldb [clang][DebugInfo] Emit DW_AT_type of preferred name if available 2023-04-07 01:37:36 +01:00
llvm [SLP][NFC]Make adjustExtracts/needToDelay members of ShuffleInstructionBuilder. 2023-04-06 16:27:19 -07:00
llvm-libgcc Revert "Reland "[CMake] Bumps minimum version to 3.20.0."" 2023-03-18 20:32:43 +01:00
mlir Add gpu::HostUnregisterOp 2023-04-06 15:07:12 -05:00
openmp [OpenMP][libomptarget] Do not rely on AsyncInfoWrapperTy's destructor 2023-04-04 17:51:28 +02:00
polly Revert "Reland "[CMake] Bumps minimum version to 3.20.0."" 2023-03-18 20:32:43 +01:00
pstl Revert "Reland "[CMake] Bumps minimum version to 3.20.0."" 2023-03-18 20:32:43 +01:00
runtimes Revert "[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag" 2023-03-28 08:28:17 +00:00
third-party Remove an extra // in the IWYU pragma for gtest-matchers.h 2023-03-14 13:11:53 +01:00
utils [Bazel] Rework llvm-tblgen for X86ManualFoldTables.def 2023-04-06 22:48:10 +09:00
.arcconfig
.arclint
.clang-format Revert "Title: [RISCV] Add missing part of instruction vmsge {u}. VX Review By: craig.topper Differential Revision : https://reviews.llvm.org/D100115" 2021-04-14 08:04:37 +01:00
.clang-tidy Add -misc-const-correctness to .clang-tidy 2022-08-08 13:00:52 -07:00
.git-blame-ignore-revs Add __config formatting to .git-blame-ignore-revs 2022-06-14 09:52:49 -04:00
.gitignore [llvm] Ignore .rej files in .gitignore 2022-04-28 08:44:51 -07:00
.mailmap Fix incorrect .mailmap entry 2023-03-27 14:02:10 -07:00
CONTRIBUTING.md Added instruction to join the llvm discourse and discord group. 2023-03-27 17:02:07 -07:00
LICENSE.TXT [docs] Add LICENSE.txt to the root of the mono-repo 2022-08-24 09:35:00 +02:00
README.md [docs] Update README and GettingStarted 2023-03-08 12:55:59 -08:00
SECURITY.md [docs] Describe reporting security issues on the chromium tracker. 2021-05-19 15:21:50 -07:00

The LLVM Compiler Infrastructure

Welcome to the LLVM project!

This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.

The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.

C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.

Other components include: the libc++ C++ standard library, the LLD linker, and more.

Getting the Source Code and Building LLVM

Consult the Getting Started with LLVM page for information on building and running LLVM.

For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.

Getting in touch

Join the LLVM Discourse forums, Discord chat, or #llvm IRC channel on OFTC.

The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.