Merge remote-tracking branch 'origin/topic/vern/CPP-cond'

* origin/topic/vern/CPP-cond:
  fix btest comment to more accurately describe the test
  clang-format issue
  btests for erroneous script conditionals
  avoid compiling-to-C++ for functions potentially influenced by conditionals
  track the use of conditionals in functions and files
  AST profiles track the associated function/body/expression
This commit is contained in:
Tim Wojtulewicz 2021-12-01 10:25:32 -07:00
commit 6a7bbd5268
14 changed files with 170 additions and 55 deletions

View file

@ -6,6 +6,8 @@
#include <sys/file.h>
#include <unistd.h>
#include "zeek/script_opt/StmtOptInfo.h"
namespace zeek::detail
{
@ -50,6 +52,14 @@ bool is_CPP_compilable(const ProfileFunc* pf, const char** reason)
return false;
}
auto body = pf->ProfiledBody();
if ( body && ! body->GetOptInfo()->is_free_of_conditionals )
{
if ( reason )
*reason = "body may be affected by @if conditional";
return false;
}
return true;
}