diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-08-19 09:01:16 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-01 16:16:31 +0000 |
| commit | 6cec91d6470eebcc6dd16e15eaca09d39769a8e5 (patch) | |
| tree | f219ca8a830a70b99f4072b06058fd6de762c7ef /library/core/src | |
| parent | 1accf068d8fa22f29437651283ea1f27058ed8ac (diff) | |
| download | rust-6cec91d6470eebcc6dd16e15eaca09d39769a8e5.tar.gz rust-6cec91d6470eebcc6dd16e15eaca09d39769a8e5.zip | |
Support debuginfo for custom MIR.
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/intrinsics/mir.rs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index b99346b6ba6..02c6f0295fc 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -361,6 +361,11 @@ define!( #[doc(hidden)] fn __internal_make_place<T>(place: T) -> *mut T ); +define!( + "mir_debuginfo", + #[doc(hidden)] + fn __debuginfo<T>(name: &'static str, s: T) +); /// Macro for generating custom MIR. /// @@ -371,6 +376,7 @@ pub macro mir { ( $(type RET = $ret_ty:ty ;)? $(let $local_decl:ident $(: $local_decl_ty:ty)? ;)* + $(debug $dbg_name:ident => $dbg_data:expr ;)* { $($entry:tt)* @@ -394,26 +400,32 @@ pub macro mir { $( let $local_decl $(: $local_decl_ty)? ; )* - ::core::intrinsics::mir::__internal_extract_let!($($entry)*); $( ::core::intrinsics::mir::__internal_extract_let!($($block)*); )* { - // Finally, the contents of the basic blocks - ::core::intrinsics::mir::__internal_remove_let!({ - {} - { $($entry)* } - }); + // Now debuginfo $( + __debuginfo(stringify!($dbg_name), $dbg_data); + )* + + { + // Finally, the contents of the basic blocks ::core::intrinsics::mir::__internal_remove_let!({ {} - { $($block)* } + { $($entry)* } }); - )* + $( + ::core::intrinsics::mir::__internal_remove_let!({ + {} + { $($block)* } + }); + )* - RET + RET + } } } }} |
