Skip to main content

luaur_analysis/records/
control_flow_graph.rs

1//! Source: `Analysis/include/Luau/ControlFlowGraph.h:257` (hand-ported)
2//! C++ `struct ControlFlowGraph`.
3use crate::records::cfg_allocator::CfgAllocator;
4use crate::type_aliases::block_id::BlockId;
5use crate::type_aliases::definition::Definition;
6use alloc::vec::Vec;
7use luaur_ast::records::ast_expr::AstExpr;
8use luaur_common::records::dense_hash_map::DenseHashMap;
9
10#[derive(Debug, Clone)]
11pub struct ControlFlowGraph {
12    // Maps each use of a local variable (AstExpr*) to the Definition* live at
13    // that point. C++ `DenseHashMap<AstExpr*, Definition*> useDefs{nullptr};`
14    pub use_defs: DenseHashMap<*mut AstExpr, *mut Definition>,
15
16    pub blocks: Vec<BlockId>,
17    pub entry_idx: usize,
18
19    // private:
20    pub(crate) allocator: *mut CfgAllocator,
21}
22
23unsafe impl Send for ControlFlowGraph {}
24unsafe impl Sync for ControlFlowGraph {}