restored support for incremental compilation of scripts to C++

This commit is contained in:
Vern Paxson 2021-12-12 12:36:45 -08:00
parent 3b3cea799b
commit 2f7137999f
11 changed files with 37 additions and 56 deletions

View file

@ -197,10 +197,10 @@ void CPPCompile::Compile(bool report_uncompilable)
void CPPCompile::GenProlog()
{
if ( addl_tag == 0 )
{
if ( addl_tag <= 1 )
// This is either a compilation via gen-C++, or
// one using add-C++ and an empty CPP-gen.cc file.
Emit("#include \"zeek/script_opt/CPP/Runtime.h\"\n");
}
Emit("namespace zeek::detail { //\n");
Emit("namespace CPP_%s { // %s\n", Fmt(addl_tag), working_dir);
@ -292,13 +292,6 @@ void CPPCompile::RegisterCompiledBody(const string& f)
events = string("{") + events + "}";
if ( addl_tag > 0 )
// Hash in the location associated with this compilation
// pass, to get a final hash that avoids conflicts with
// identical-but-in-a-different-context function bodies
// when compiling potentially conflicting additional code.
h = merge_p_hashes(h, p_hash(cf_locs[f]));
auto fi = func_index.find(f);
ASSERT(fi != func_index.end());
auto type_signature = casting_index[fi->second];