binpac: Make sure pac_expr fields are initialized

This commit is contained in:
Tim Wojtulewicz 2025-07-01 16:30:21 -07:00
parent b9b4fcb78b
commit 710e2eaced

View file

@ -1,6 +1,8 @@
#ifndef pac_expr_h #ifndef pac_expr_h
#define pac_expr_h #define pac_expr_h
#include <cstdint>
#include "pac_common.h" #include "pac_common.h"
#include "pac_datadep.h" #include "pac_datadep.h"
@ -8,7 +10,7 @@ class CaseExpr;
class Expr : public Object, public DataDepElement { class Expr : public Object, public DataDepElement {
public: public:
enum ExprType { enum ExprType : uint8_t {
#define EXPR_DEF(type, x, y) type, #define EXPR_DEF(type, x, y) type,
#include "pac_expr.def" #include "pac_expr.def"
#undef EXPR_DEF #undef EXPR_DEF
@ -93,16 +95,16 @@ protected:
private: private:
ExprType expr_type_; ExprType expr_type_;
int num_operands_; int num_operands_ = 0;
Expr* operand_[3]; Expr* operand_[3] = {nullptr};
ID* id_; // EXPR_ID ID* id_ = nullptr; // EXPR_ID
Number* num_; // EXPR_NUM Number* num_ = nullptr; // EXPR_NUM
ConstString* cstr_; // EXPR_CSTR ConstString* cstr_ = nullptr; // EXPR_CSTR
RegEx* regex_; // EXPR_REGEX RegEx* regex_ = nullptr; // EXPR_REGEX
ExprList* args_; // EXPR_CALLARGS ExprList* args_ = nullptr; // EXPR_CALLARGS
CaseExprList* cases_; // EXPR_CASE CaseExprList* cases_ = nullptr; // EXPR_CASE
Nullptr* nullp_; // EXPR_NULLPTR Nullptr* nullp_ = nullptr; // EXPR_NULLPTR
string str_; // value string string str_; // value string
string orig_; // original string for debugging info string orig_; // original string for debugging info