Merge remote-tracking branch 'origin/topic/vern/script-opt-uncompilable-AST'

* origin/topic/vern/script-opt-uncompilable-AST:
  ScriptOpt: Fail compilation if known exprs/stmts is outdated
  skip optimization of functions with AST nodes unknown to script optimization
This commit is contained in:
Arne Welzel 2024-12-09 14:03:29 +01:00
commit 0ebcd9608f
9 changed files with 170 additions and 10 deletions

View file

@ -39,6 +39,12 @@ string scope_prefix(const string& scope) { return "zeek::detail::CPP_" + scope;
string scope_prefix(int scope) { return scope_prefix(to_string(scope)); }
bool is_CPP_compilable(const ProfileFunc* pf, const char** reason) {
if ( has_AST_node_unknown_to_script_opt(pf, false) ) {
if ( reason )
*reason = "unknown AST node type";
return false;
}
if ( analysis_options.allow_cond )
return true;