mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
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:
commit
6a7bbd5268
14 changed files with 170 additions and 55 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue