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.
This commit is contained in:
Benjamin Bannier 2023-10-10 21:13:34 +02:00
parent 7b8e7ed72c
commit f5a76c1aed
786 changed files with 131714 additions and 153609 deletions

View file

@ -4,15 +4,13 @@
#pragma once
namespace zeek::detail
{
namespace zeek::detail {
// Opcodes associated with ZAM instructions.
enum ZOp
{
enum ZOp {
#include "zeek/ZAM-OpsDefs.h"
OP_NOP,
};
OP_NOP,
};
// Possible types of instruction operands in terms of which fields they use.
// Used for low-level optimization (so important that they're correct),
@ -23,45 +21,43 @@ enum ZOp
// I1/I2/I3/I4: the instruction's integer value, used directly (not as a slot)
// FRAME: a slot in the (interpreter) Frame object
// X: no operands
enum ZAMOpType
{
OP_X,
OP_C,
OP_V,
OP_V_I1,
OP_VC_I1,
enum ZAMOpType {
OP_X,
OP_C,
OP_V,
OP_V_I1,
OP_VC_I1,
OP_VC,
OP_VV,
OP_VV_I2,
OP_VV_I1_I2,
OP_VV_FRAME,
OP_VC,
OP_VV,
OP_VV_I2,
OP_VV_I1_I2,
OP_VV_FRAME,
OP_VVC,
OP_VVC_I2,
OP_VVV,
OP_VVV_I3,
OP_VVV_I2_I3,
OP_VVC,
OP_VVC_I2,
OP_VVV,
OP_VVV_I3,
OP_VVV_I2_I3,
OP_VVVC,
OP_VVVC_I3,
OP_VVVC_I2_I3,
OP_VVVC_I1_I2_I3,
OP_VVVV,
OP_VVVV_I4,
OP_VVVV_I3_I4,
OP_VVVV_I2_I3_I4,
OP_VVVC,
OP_VVVC_I3,
OP_VVVC_I2_I3,
OP_VVVC_I1_I2_I3,
OP_VVVV,
OP_VVVV_I4,
OP_VVVV_I3_I4,
OP_VVVV_I2_I3_I4,
};
};
// Possible "flavors" for an operator's first slot.
enum ZAMOp1Flavor
{
OP1_READ, // the slot is read, not modified
OP1_WRITE, // the slot is modified, not read - the most common
OP1_READ_WRITE, // the slot is both read and then modified, e.g. "++"
OP1_INTERNAL, // we're doing some internal manipulation of the slot
};
enum ZAMOp1Flavor {
OP1_READ, // the slot is read, not modified
OP1_WRITE, // the slot is modified, not read - the most common
OP1_READ_WRITE, // the slot is both read and then modified, e.g. "++"
OP1_INTERNAL, // we're doing some internal manipulation of the slot
};
// Maps an operand to its flavor.
extern ZAMOp1Flavor op1_flavor[];
@ -69,4 +65,4 @@ extern ZAMOp1Flavor op1_flavor[];
// Maps an operand to whether it has side effects.
extern bool op_side_effects[];
} // namespace zeek::detail
} // namespace zeek::detail