about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
AgeCommit message (Collapse)AuthorLines
2025-01-29Clean up uses of the unstable `dwarf_version` optionWesley Wiser-25/+27
- Consolidate calculation of the effective value. - Check the target `DebuginfoKind` instead of using `is_like_msvc`.
2025-01-20Auto merge of #135643 - khuey:135332, r=jieyouxubors-39/+24
When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely Dropping them fails `-Zverify-llvm-ir`. Fixes #135332. r? `@jieyouxu`
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-1/+1
2025-01-19When LLVM's location discriminator value limit is exceeded, emit locations ↵Kyle Huey-39/+24
with dummy spans instead of dropping them entirely Revert most of #133194 (except the test and the comment fixes). Then refix not emitting locations at all when the correct location discriminator value exceeds LLVM's capacity.
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-5/+5
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2025-01-05Explain why the `DW_TAG_*` constants remain as-is for nowZalathar-0/+4
2025-01-05Use constants for DWARF opcodes, instead of FFI callsZalathar-9/+14
2025-01-05Use gimli to get the values of DWARF constants needed by codegenZalathar-24/+40
The `gimli` crate is already a dependency of `thorin-dwp`, which is already a dependency of `rustc_codegen_ssa`.
2024-12-30force enum `DISCR_*` to `const u64` to allow for inspection via LLDB's ↵Walnut-17/+37
`SBTypeStaticField::GetConstantValue()`
2024-12-18fix outdated commentRalf Jung-2/+1
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-17/+15
2024-12-18Variants::Single: do not use invalid VariantIdx for uninhabited enumsRalf Jung-2/+2
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-5/+3
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-06Remove polymorphizationBen Kimock-22/+0
2024-12-03Auto merge of #104342 - mweber15:add_file_location_to_more_types, r=wesleywiserbors-27/+228
Require `type_map::stub` callers to supply file information This change attaches file information (`DIFile` reference and line number) to struct debug info nodes. Before: ``` ; foo.ll ... !5 = !DIFile(filename: "<unknown>", directory: "") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !5, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "4cb373851db92e732c4cb5651b886dd0") ... ``` After: ``` ; foo.ll ... !3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !3, line: 3, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "9e5968c7af39c148acb253912b7f409f") ... ``` Fixes #98678 r? `@wesleywiser`
2024-11-19When the required discriminator value exceeds LLVM's limits, drop the debug ↵Kyle Huey-20/+40
info for the function instead of panicking. The maximum discriminator value LLVM can currently encode is 2^12. If macro use results in more than 2^12 calls to the same function attributed to the same callsite, and those calls are MIR-inlined, we will require more than the maximum discriminator value to completely represent the debug information. Once we reach that point drop the debug info instead.
2024-11-19Honor collapse_debuginfo when dealing with MIR-inlined functions inside macros.Kyle Huey-3/+2
The test relies on the fact that inlining more than 2^12 calls at the same callsite will trigger a panic (and after the following commit, a warning) due to LLVM limitations but with collapse_debuginfo the callsites should not be the same.
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-29/+35
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-12Rollup merge of #132702 - 1c3t3a:issue-132615, r=rcvalleMatthias Krüger-0/+4
CFI: Append debug location to CFI blocks Currently we're not appending debug locations to the inserted CFI blocks. This shows up in #132615 and #100783. This change fixes that by passing down the debug location to the CFI type-test generation and appending it to the blocks. Credits also belong to `@jakos-sec` who worked with me on this.
2024-11-11CFI: Append debug location to CFI blocksBastian Kersting-0/+4
2024-11-09Add discriminators to DILocations when multiple functions are inlined into a ↵Kyle Huey-3/+57
single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixes #131944
2024-11-06Clean up use requirements after rebasingMatt Weber-5/+4
2024-11-06Add location info for f16Matt Weber-0/+18
2024-11-06Rename option and add docMatt Weber-45/+40
2024-11-06Add additional option checksMatt Weber-9/+38
2024-11-06Move additional source location info behind -Z optionMatt Weber-20/+105
2024-11-06Refactor `type_stub` from `DefId` to tupleMatt Weber-22/+26
2024-11-06Add file and line metadata for enum variant and fieldsMatt Weber-17/+23
2024-11-06Add file and line metadata for struct/union membersMatt Weber-10/+35
2024-11-06Add file and line metadata for coroutinesMatt Weber-2/+5
2024-11-06Refactor `type_map::stub` parametersMatt Weber-60/+44
Push span lookup into `type_map::stub` and pass the `DefId` instead of doing the lookup outside and passing in the location metadata.
2024-11-06Add file and line metadata for closuresMatt Weber-2/+10
2024-11-06Require `type_map::stub` callers to supply file informationMatt Weber-6/+51
This change attaches file information (`DIFile` reference and line number) to struct debug info nodes. Before: ``` ; foo.ll ... !5 = !DIFile(filename: "<unknown>", directory: "") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !5, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "4cb373851db92e732c4cb5651b886dd0") ... ``` After: ``` ; foo.ll ... !3 = !DIFile(filename: "foo.rs", directory: "/home/matt/src/rust98678", checksumkind: CSK_SHA1, checksum: "bcb9f08512c8f3b8181ef4726012bc6807bc9be4") ... !16 = !DICompositeType(tag: DW_TAG_structure_type, name: "MyType", scope: !2, file: !3, line: 3, size: 32, align: 32, elements: !17, templateParams: !19, identifier: "9e5968c7af39c148acb253912b7f409f") ... ``` Fixes #98678
2024-11-03compiler: Directly use rustc_abi in codegenJubilee Young-6/+6
2024-10-31Remove support for `-Zprofile` (gcov-style coverage instrumentation)Zalathar-29/+0
2024-10-30Consistently use safe wrapper function `set_section`Zalathar-1/+1
2024-10-29Clean up FFI calls for setting module flagsZalathar-36/+30
- Don't rely on enum values defined by LLVM's C++ API - Use safe wrapper functions instead of direct `unsafe` calls - Consistently pass pointer/length strings instead of C strings
2024-10-28Rollup merge of #132260 - Zalathar:type-safe-cast, r=compiler-errorsJubilee-50/+50
cg_llvm: Use a type-safe helper to cast `&str` and `&[u8]` to `*const c_char` In `rustc_codegen_llvm` there are many uses of `.as_ptr().cast()` to convert a string or byte-slice to `*const c_char`, which then gets passed through FFI. This works, but is fragile, because there's nothing constraining the pointer cast to actually be from `u8` to `c_char`. If the original value changes to something else that has an `as_ptr` method, or the context changes to expect something other than `c_char`, the cast will silently do the wrong thing. By making the cast more explicit via a helper method, we can be sure that it will either perform the intended cast, or fail at compile time.
2024-10-28compiler: Add `is_uninhabited` and use LayoutS accessorsJubilee Young-1/+1
This reduces the need of the compiler to peek on the fields of LayoutS.
2024-10-28Use a type-safe helper to cast `&str` and `&[u8]` to `*const c_char`Zalathar-50/+50
2024-10-26Use safe wrappers `get_linkage` and `set_linkage`Zalathar-1/+1
2024-10-26Effects cleanupDeadbeef-1/+0
- removed extra bits from predicates queries that are no longer needed in the new system - removed the need for `non_erasable_generics` to take in tcx and DefId, removed unused arguments in callers
2024-10-04Use wide pointers consistenly across the compilerUrgau-24/+24
2024-10-01add unstable support for outputting file checksums for use in cargoJacob Kiesel-0/+1
2024-09-24Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikicbors-8/+4
llvm: replace some deprecated functions `LLVMMDStringInContext` and `LLVMMDNodeInContext` are deprecated, replace them with `LLVMMDStringInContext2` and `LLVMMDNodeInContext2`. Also replace `Value` with `Metadata` in some function signatures for better consistency.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-34/+31
2024-09-20Do not unnecessarily eval consts in codegenMichael Goulet-1/+3
2024-09-19Reformat some comments.Nicholas Nethercote-13/+14
So they are less than 100 chars.
2024-09-19Remove a low-value local variable.Nicholas Nethercote-2/+1
2024-09-19replace some deprecated functionsLuv-Ray-8/+4