pub struct InlineFnDict { /* private fields */ }Expand description
inline 関数辞書
FunctionDef をそのまま保持し、型情報は AST から直接取得する。 各 inline 関数の呼び出し先(called_functions)と利用可能性も追跡する。
Implementations§
Source§impl InlineFnDict
impl InlineFnDict
Sourcepub fn insert(&mut self, name: InternedStr, func_def: FunctionDef)
pub fn insert(&mut self, name: InternedStr, func_def: FunctionDef)
inline 関数を登録
Sourcepub fn get(&self, name: InternedStr) -> Option<&FunctionDef>
pub fn get(&self, name: InternedStr) -> Option<&FunctionDef>
inline 関数を取得
Sourcepub fn iter(&self) -> impl Iterator<Item = (&InternedStr, &FunctionDef)>
pub fn iter(&self) -> impl Iterator<Item = (&InternedStr, &FunctionDef)>
全ての inline 関数を走査
Sourcepub fn get_called_functions(
&self,
name: InternedStr,
) -> Option<&HashSet<InternedStr>>
pub fn get_called_functions( &self, name: InternedStr, ) -> Option<&HashSet<InternedStr>>
inline 関数の呼び出し先を取得
利用不可関数を呼び出すかどうか
利用不可フラグを設定
Sourcepub fn is_apidoc_suppressed(&self, name: InternedStr) -> bool
pub fn is_apidoc_suppressed(&self, name: InternedStr) -> bool
apidoc skip_codegen 対象かどうか
Sourcepub fn set_apidoc_suppressed(&mut self, name: InternedStr)
pub fn set_apidoc_suppressed(&mut self, name: InternedStr)
apidoc skip_codegen フラグを設定
出力可否の総合判定
calls_unavailable(不在関数を呼ぶ/推移的)または
apidoc_suppressed(自分が skip_codegen 対象)のいずれかが立っていれば
codegen 対象外。
Sourcepub fn apply_apidoc_suppressions(
&mut self,
patches: &ApidocPatchSet,
interner: &StringInterner,
) -> usize
pub fn apply_apidoc_suppressions( &mut self, patches: &ApidocPatchSet, interner: &StringInterner, ) -> usize
apidoc skip_codegen を apidoc_suppressed 集合に反映
patches.skip_codegen の各エントリ名を interner で解決し、
該当する inline 関数が辞書に登録されていれば apidoc_suppressed
に追加する。マッチした関数数を返す(マクロ側のマッチは
MacroInferContext::apply_apidoc_suppressions が別途扱う)。
Sourcepub fn called_functions_iter(
&self,
) -> impl Iterator<Item = (&InternedStr, &HashSet<InternedStr>)>
pub fn called_functions_iter( &self, ) -> impl Iterator<Item = (&InternedStr, &HashSet<InternedStr>)>
called_functions の全エントリを走査
Sourcepub fn collect_from_function_def(
&mut self,
func_def: &FunctionDef,
interner: &StringInterner,
)
pub fn collect_from_function_def( &mut self, func_def: &FunctionDef, interner: &StringInterner, )
FunctionDef から inline 関数を収集
inline または static(内部リンケージ)の関数を対象とする。
STATIC (= static) のみで inline でない関数も翻訳単位ローカルなため
Rust 側に独自に持つ意味論的問題はない(bodies_by_type 配列と同じ理屈)。
例: perlstatic.h の Perl_croak_memory_wrap (STATIC void) を取り込む
ことで、これを呼ぶ inline 関数 (Perl_newSV_type 等) のカスケード解消に
寄与する。
assert/assert_ 呼び出しを Assert 式に変換してから保存する。 関数呼び出し先(called_functions)も同時に収集する。