diff options
| author | Kyle Huey <khuey@kylehuey.com> | 2024-11-18 18:48:10 -0800 |
|---|---|---|
| committer | Kyle Huey <khuey@kylehuey.com> | 2024-11-19 05:19:09 -0800 |
| commit | f5b023bd9cf43803a6d39b101c54a98cb7e7da7c (patch) | |
| tree | 5598ae3f48cafe381989a664a47365f3eb5553aa /compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | |
| parent | 1e4ebb0ccdffe4a8ddb15cb8e95bef3b905f045b (diff) | |
| download | rust-f5b023bd9cf43803a6d39b101c54a98cb7e7da7c.tar.gz rust-f5b023bd9cf43803a6d39b101c54a98cb7e7da7c.zip | |
When the required discriminator value exceeds LLVM's limits, drop the debug 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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index 4b650b00bee..a8fdfbed592 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -294,12 +294,12 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { } // Initialize fn debug context (including scopes). - let empty_scope = DebugScope { + let empty_scope = Some(DebugScope { dbg_scope: self.dbg_scope_fn(instance, fn_abi, Some(llfn)), inlined_at: None, file_start_pos: BytePos(0), file_end_pos: BytePos(0), - }; + }); let mut fn_debug_context = FunctionDebugContext { scopes: IndexVec::from_elem(empty_scope, &mir.source_scopes), inlined_function_scopes: Default::default(), |
