Fix clang-tidy performance-enum-size warnings in headers

This commit is contained in:
Tim Wojtulewicz 2025-06-09 17:06:52 -07:00
parent 89ac0cb418
commit f386deba94
76 changed files with 184 additions and 136 deletions

View file

@ -4,9 +4,11 @@
#pragma once
#include <cstdint>
namespace zeek::detail {
enum AttrExprType {
enum AttrExprType : uint8_t {
AE_NONE, // attribute doesn't have an expression
AE_CONST, // easy expression - a constant (ConstExpr)
AE_NAME, // easy - a global (NameExpr)

View file

@ -16,7 +16,10 @@
// values, the end goal is to have the value in (1) native form, (2) instead
// in ValPtr form, or (3) whichever is more convenient to generate (sometimes
// used when the caller knows that the value is non-native).
enum GenType {
#include <cstdint>
enum GenType : uint8_t {
GEN_NATIVE,
GEN_VAL_PTR,
GEN_DONT_CARE,

View file

@ -234,7 +234,7 @@ protected:
class ScriptOptBuiltinExpr : public Expr {
public:
enum SOBuiltInTag {
enum SOBuiltInTag : uint8_t {
MINIMUM,
MAXIMUM,
HAS_ELEMENTS,

View file

@ -314,7 +314,7 @@ public:
// CONSTRUCTION - relevant for constructing/coercing a record
// READ - relevant for reading a table element
// WRITE - relevant for modifying a table element
enum AccessType { NONE, CALL, CONSTRUCTION, READ, WRITE };
enum AccessType : uint8_t { NONE, CALL, CONSTRUCTION, READ, WRITE };
SideEffectsOp(AccessType at = NONE, const Type* t = nullptr) : access(at), type(t) {}

View file

@ -132,7 +132,7 @@ public:
// values assigned to them reflecting the bit-pattern of the arguments from
// left (most significant) to right (least), with a 1-bit encoding Constant,
// 0-bit for Variable.
enum BiFArgsType {
enum BiFArgsType : uint8_t {
VV = 0x0,
VC = 0x1,
CV = 0x2,

View file

@ -93,7 +93,7 @@ private:
bool is_managed = false;
};
enum ControlFlowType {
enum ControlFlowType : uint8_t {
CFT_IF,
CFT_BLOCK_END,
CFT_ELSE,

View file

@ -4,6 +4,7 @@
#pragma once
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
@ -11,7 +12,7 @@
namespace zeek::detail {
// Opcodes associated with ZAM instructions.
enum ZOp {
enum ZOp : uint16_t {
#include "zeek/ZAM-OpsDefs.h"
OP_NOP,
};
@ -25,7 +26,7 @@ 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 {
enum ZAMOpType : uint8_t {
OP_X,
OP_C,
OP_V,
@ -56,7 +57,7 @@ enum ZAMOpType {
};
// Possible "flavors" for an operator's first slot.
enum ZAMOp1Flavor {
enum ZAMOp1Flavor : uint8_t {
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. "++"