mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Merge remote-tracking branch 'origin/topic/vern/CPP-workflow2'
* origin/topic/vern/CPP-workflow2: low-level coding style fixes support for standalone compiled scripts to export globals with module qualifiers updates for documentation of functionality for compiling scripts to C++ fixes for standalone C++ scripts making types & variables/functions available fixed bug limiting availability of load_CPP() BiF updates to development helper scripts to support new workflow simpler workflow for -O gen-C++ ; also some hooks for -O gen-standalone-C++ ReplaceBody now deletes a body if the replacement is nil removal of can't-actually-be-executed code
This commit is contained in:
commit
0b342b7bfa
26 changed files with 335 additions and 124 deletions
|
@ -262,15 +262,18 @@ string CPPCompile::GenCallExpr(const CallExpr* c, GenType gt)
|
|||
auto f_id = f->AsNameExpr()->Id();
|
||||
const auto& params = f_id->GetType()->AsFuncType()->Params();
|
||||
auto id_name = f_id->Name();
|
||||
auto fname = Canonicalize(id_name) + "_zf";
|
||||
|
||||
bool is_compiled = compiled_funcs.count(fname) > 0;
|
||||
bool is_compiled = compiled_simple_funcs.count(id_name) > 0;
|
||||
bool was_compiled = hashed_funcs.count(id_name) > 0;
|
||||
|
||||
if ( is_compiled || was_compiled )
|
||||
{
|
||||
string fname;
|
||||
|
||||
if ( was_compiled )
|
||||
fname = hashed_funcs[id_name];
|
||||
else
|
||||
fname = compiled_simple_funcs[id_name];
|
||||
|
||||
if ( args_l->Exprs().length() > 0 )
|
||||
gen = fname + "(" + GenArgs(params, args_l) +
|
||||
|
@ -499,12 +502,6 @@ string CPPCompile::GenSizeExpr(const Expr* e, GenType gt)
|
|||
else if ( it == TYPE_INTERNAL_DOUBLE )
|
||||
gen = string("fabs__CPP(") + gen + ")";
|
||||
|
||||
else if ( it == TYPE_INTERNAL_INT || it == TYPE_INTERNAL_DOUBLE )
|
||||
{
|
||||
auto cast = (it == TYPE_INTERNAL_INT) ? "bro_int_t" : "double";
|
||||
gen = string("abs__CPP(") + cast + "(" + gen + "))";
|
||||
}
|
||||
|
||||
else
|
||||
return GenericValPtrToGT(gen + "->SizeVal()", t, gt);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue