Commit graph

192 commits

Author SHA1 Message Date
Vern Paxson
5c38f7637d -O gen-C++ fix for run-time warnings for "when" lambdas 2024-09-27 13:23:06 -07:00
Vern Paxson
d1c31927c4 fix to -O gen-C++ for recent AST profiling changes for identifying function parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
2b64e3b05e fix to -O gen-C++ for dealing with "hidden" parameters 2024-09-27 13:23:06 -07:00
Vern Paxson
8025ee74ef tweak to prevent an incorrect warning for scripts compiled to C++ 2024-09-27 13:23:06 -07:00
Vern Paxson
c165e05b83 remove unnecessary header include 2024-09-27 13:23:06 -07:00
Arne Welzel
71e9c8d436 script_opt: Use Func::GetName() 2024-09-27 15:11:17 +02:00
Benjamin Bannier
db42b2cfe5 Bump clang-format
This patch contains a bump of the configured clang-format version from
17.0.3 to 18.1.8 and automatically generated C++ source updates. The
main difference we are seeing from this is fixes for previously
incomplete reformats.
2024-09-02 16:46:59 +02:00
Arne Welzel
5e36709905 Func: Add SetCapturesVec()
Add an API to directly set captures_vec for use by C++ compilation. The
current code keys off or asserts on ZAM stmts, making it difficult to
leverage captures_vec in other contexts.
2024-08-15 10:10:00 +02:00
Vern Paxson
207b82ae4b robustness improvements for -O gen-C++ generation of lambdas / "when"s 2024-08-13 14:45:33 -07:00
Vern Paxson
0ca2f9a8b2 speedups for compilation of initializers in -O gen-C++ generated code 2024-08-13 14:43:17 -07:00
Vern Paxson
6daf9d5b88 fixes for -O gen-C++ generation of floating point constants 2024-08-13 14:42:25 -07:00
Vern Paxson
a93a69ba62 -O gen-C++ fix for dealing with use of more than one module qualifier 2024-08-13 14:41:51 -07:00
Vern Paxson
77c34787f3 header tweaks to provide gen-C++ script optimization with more flexibility 2024-08-13 14:37:06 -07:00
Vern Paxson
769a3d958a some minor tidying of -O gen-C++ sources 2024-08-13 14:29:26 -07:00
Tim Wojtulewicz
e2b03681d1 Remove EventRegistry::Used and EventRegistry::SetUsed 2024-08-07 11:58:21 -07:00
Vern Paxson
37c1f6641c script optimization support for "add" and "delete" being expressions 2024-05-29 12:40:06 -07:00
Vern Paxson
7c8c83efc4 factor script optimization Expr AST nodes out of main AST header 2024-04-25 09:15:13 -07:00
Vern Paxson
4e253aae0a optimize generation of "-O gen-C++" code for table/vector size operations 2024-04-25 09:15:12 -07:00
Vern Paxson
74d36eb759 script optimization support for clearing tables/vectors using "delete" 2024-03-08 19:09:46 +01:00
Vern Paxson
54877e9dec fixed bug where appending an empty vector to a vector-of-vector's had no effect 2024-03-08 19:09:43 +01:00
Vern Paxson
9e32443504 minor updates and fixes for script optimization maintenance 2024-02-04 07:57:45 -08:00
Vern Paxson
f7b739a47d fixes for initializations of "-O gen-C++" script compilations 2024-01-15 15:03:56 +01:00
Tim Wojtulewicz
df65b668b7 CPP-gen: Don't emit extra braces if only one element 2024-01-08 13:26:57 -07:00
Vern Paxson
e2646f9752 fix for -O C++ lambda functions reporting errors/warnings 2023-12-12 09:45:19 +01:00
Vern Paxson
f573036099 script optimization fixes for pattern tables 2023-12-12 09:45:19 +01:00
Vern Paxson
709d410fcd regularized (some) types of pointers used in script optimization 2023-12-12 09:45:19 +01:00
Vern Paxson
a824bb1e4b some very minor tidying of script optimization code/documentation 2023-12-12 09:45:19 +01:00
Dominik Charousset
a69928d977 Integrate review feedback 2023-12-04 15:23:56 +01:00
Dominik Charousset
647fdf7737 Add facade types to avoid using raw Broker types
By avoiding to use `broker::data` directly, we gain a degree of freedom
that allows us to swap out `broker::data` for something else (e.g.,
`broker::variant`) in the future. Furthermore, it also helps us to keep
Broker types "local" to the Broker manager and gives us a nicer
interface.

Also replaces uses of `broker::expected` with `std::optional`. While an
`expected `can carry additional information as to why a value is not
present, nothing in Zeek ever cared about that. Hence, using
`std::optional` removes an unnecessary dependency on a Broker detail
while also being more efficient (no extra heap allocation when no value
is present).
2023-12-04 15:23:28 +01:00
Arne Welzel
501b582bc7 TablePatternMatcher: Use const StringValPtr& instead of const StringVal* 2023-11-21 10:34:16 +01:00
Arne Welzel
c8bab6a0ec IndexType: Add IsPatternIndex(), like IsSubNetIndex() 2023-11-21 10:34:16 +01:00
Vern Paxson
61fcca8482 script optimization support for using strings to index table[pattern] values 2023-11-21 10:34:16 +01:00
Vern Paxson
c49918ba8b fixed some warnings about mixing signed & unsigned integers 2023-11-10 09:56:59 +01:00
Arne Welzel
ff34a4aa7f EventHandler: Deprecate SetUsed() and Used() as well.
Seems the latter isn't used outside of the functions that were deprecated
in the previous commit and with UsageAnalyzer not making use of this
information unclear why we should keep it around.

Relates to #3187.
2023-11-07 16:06:35 +01:00
Dominik Charousset
cebb85b1e8 Fix unsafe and inefficient uses of copy_string
Add a new overload to `copy_string` that takes the input characters plus
size. The new overload avoids inefficient scanning of the input for the
null terminator in cases where we know the size beforehand. Furthermore,
this overload *must* be used when dealing with input character sequences
that may have no null terminator, e.g., when the input is from a
`std::string_view` object.
2023-11-03 15:25:38 +01:00
Benjamin Bannier
f5a76c1aed Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
2023-10-30 09:40:55 +01:00
Vern Paxson
417a99ed0d minor updates to -O gen-C++ maintenance notes and scripts 2023-09-27 15:56:31 -07:00
Vern Paxson
434a7e059d introduce internal "mask" expression node to avoid mixed-type overloading of "/" 2023-09-26 14:39:26 -07:00
Vern Paxson
80eed34985 -O gen-C++ fixes for compatibility with GH-3249 changes
minor -O gen-C++ BTest updates
2023-09-01 12:17:38 -07:00
Vern Paxson
e8f4e54475 change Trigger constructor to not potentially auto-delete itself 2023-08-28 10:17:26 -07:00
Vern Paxson
1473149579 updated notes regarding "-O gen-C++" maintenance 2023-08-24 11:47:01 -07:00
Vern Paxson
81a9745fb3 "-O gen-C++" support for "assert" statements 2023-08-24 11:46:59 -07:00
Vern Paxson
4928e074d4 addressed some nits re "-O gen-C++" script optimization 2023-08-16 17:04:39 -07:00
Vern Paxson
6af0014a7b fixes for compiling lambdas to C++ 2023-08-16 17:03:37 -07:00
Tim Wojtulewicz
067bbf82fb Fix script_opt/cpp test scripts to work correctly on all platforms 2023-07-25 08:39:31 -07:00
Tim Wojtulewicz
c9f6b3463f CPP code-gen: Use std::move for constructor arguments 2023-07-25 08:39:31 -07:00
Tim Wojtulewicz
73adf2bf01 CPP code-gen: Mark child classes final, remove final from function defs 2023-07-25 08:39:31 -07:00
Vern Paxson
10797bb955 -O gen-C++ fix for recent smart pointer changes 2023-07-13 15:05:16 -07:00
Vern Paxson
5480dc8869 fixes for compiling function calls that return non-error nil ValPtr's 2023-07-13 13:06:42 -07:00
Tim Wojtulewicz
64b78f6fb9 Use emplace_back over push_back where appropriate 2023-07-07 09:17:05 -07:00