Skip to main content

rustc_codegen_llvm/debuginfo/
dwarf_const.rs

1//! Definitions of various DWARF-related constants.
2
3use libc::c_uint;
4
5/// Helper macro to let us redeclare gimli's constants as our own constants
6/// with a different type, with less risk of copy-paste errors.
7macro_rules! declare_constant {
8    (
9        $name:ident : $type:ty
10    ) => {
11        #[allow(non_upper_case_globals)]
12        pub(crate) const $name: $type = ::gimli::constants::$name.0 as $type;
13
14        // Assert that as-cast probably hasn't changed the value.
15        const _: () = assert!($name as i128 == ::gimli::constants::$name.0 as i128);
16    };
17}
18
19#[allow(non_upper_case_globals)]
pub(crate) const DW_TAG_const_type: c_uint =
    ::gimli::constants::DW_TAG_const_type.0 as c_uint;
const _: () =
    if !(DW_TAG_const_type as i128 ==
                ::gimli::constants::DW_TAG_const_type.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_TAG_const_type as i128 == ::gimli::constants::DW_TAG_const_type.0 as i128")
    };declare_constant!(DW_TAG_const_type: c_uint);
20
21// DWARF languages.
22#[allow(non_upper_case_globals)]
pub(crate) const DW_LANG_Rust: c_uint =
    ::gimli::constants::DW_LANG_Rust.0 as c_uint;
const _: () =
    if !(DW_LANG_Rust as i128 == ::gimli::constants::DW_LANG_Rust.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_LANG_Rust as i128 == ::gimli::constants::DW_LANG_Rust.0 as i128")
    };declare_constant!(DW_LANG_Rust: c_uint);
23
24// DWARF attribute type encodings.
25#[allow(non_upper_case_globals)]
pub(crate) const DW_ATE_boolean: c_uint =
    ::gimli::constants::DW_ATE_boolean.0 as c_uint;
const _: () =
    if !(DW_ATE_boolean as i128 ==
                ::gimli::constants::DW_ATE_boolean.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_ATE_boolean as i128 == ::gimli::constants::DW_ATE_boolean.0 as i128")
    };declare_constant!(DW_ATE_boolean: c_uint);
26#[allow(non_upper_case_globals)]
pub(crate) const DW_ATE_float: c_uint =
    ::gimli::constants::DW_ATE_float.0 as c_uint;
const _: () =
    if !(DW_ATE_float as i128 == ::gimli::constants::DW_ATE_float.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_ATE_float as i128 == ::gimli::constants::DW_ATE_float.0 as i128")
    };declare_constant!(DW_ATE_float: c_uint);
27#[allow(non_upper_case_globals)]
pub(crate) const DW_ATE_signed: c_uint =
    ::gimli::constants::DW_ATE_signed.0 as c_uint;
const _: () =
    if !(DW_ATE_signed as i128 == ::gimli::constants::DW_ATE_signed.0 as i128)
        {
        ::core::panicking::panic("assertion failed: DW_ATE_signed as i128 == ::gimli::constants::DW_ATE_signed.0 as i128")
    };declare_constant!(DW_ATE_signed: c_uint);
28#[allow(non_upper_case_globals)]
pub(crate) const DW_ATE_unsigned: c_uint =
    ::gimli::constants::DW_ATE_unsigned.0 as c_uint;
const _: () =
    if !(DW_ATE_unsigned as i128 ==
                ::gimli::constants::DW_ATE_unsigned.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_ATE_unsigned as i128 == ::gimli::constants::DW_ATE_unsigned.0 as i128")
    };declare_constant!(DW_ATE_unsigned: c_uint);
29#[allow(non_upper_case_globals)]
pub(crate) const DW_ATE_UTF: c_uint =
    ::gimli::constants::DW_ATE_UTF.0 as c_uint;
const _: () =
    if !(DW_ATE_UTF as i128 == ::gimli::constants::DW_ATE_UTF.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_ATE_UTF as i128 == ::gimli::constants::DW_ATE_UTF.0 as i128")
    };declare_constant!(DW_ATE_UTF: c_uint);
30
31// DWARF expression operators.
32#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_deref: u64 = ::gimli::constants::DW_OP_deref.0 as u64;
const _: () =
    if !(DW_OP_deref as i128 == ::gimli::constants::DW_OP_deref.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_OP_deref as i128 == ::gimli::constants::DW_OP_deref.0 as i128")
    };declare_constant!(DW_OP_deref: u64);
33#[allow(non_upper_case_globals)]
pub(crate) const DW_OP_plus_uconst: u64 =
    ::gimli::constants::DW_OP_plus_uconst.0 as u64;
const _: () =
    if !(DW_OP_plus_uconst as i128 ==
                ::gimli::constants::DW_OP_plus_uconst.0 as i128) {
        ::core::panicking::panic("assertion failed: DW_OP_plus_uconst as i128 == ::gimli::constants::DW_OP_plus_uconst.0 as i128")
    };declare_constant!(DW_OP_plus_uconst: u64);
34/// Defined by LLVM in `llvm/include/llvm/BinaryFormat/Dwarf.h`.
35/// Double-checked by a static assertion in `RustWrapper.cpp`.
36#[allow(non_upper_case_globals)]
37pub(crate) const DW_OP_LLVM_fragment: u64 = 0x1000;
38// It describes the actual value of a source variable which might not exist in registers or in memory.
39#[allow(non_upper_case_globals)]
40pub(crate) const DW_OP_stack_value: u64 = 0x9f;