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

@ -11,44 +11,41 @@
#include "zeek/ID.h"
#include "zeek/script_opt/IDOptInfo.h"
namespace zeek::detail
{
namespace zeek::detail {
class TempVar
{
class TempVar {
public:
TempVar(size_t num, const TypePtr& t, ExprPtr rhs);
TempVar(size_t num, const TypePtr& t, ExprPtr rhs);
const char* Name() const { return name.data(); }
const zeek::Type* Type() const { return type.get(); }
const Expr* RHS() const { return rhs.get(); }
const char* Name() const { return name.data(); }
const zeek::Type* Type() const { return type.get(); }
const Expr* RHS() const { return rhs.get(); }
IDPtr Id() const { return id; }
void SetID(IDPtr _id)
{
id = std::move(_id);
id->GetOptInfo()->SetTemp();
}
void Deactivate() { active = false; }
bool IsActive() const { return active; }
IDPtr Id() const { return id; }
void SetID(IDPtr _id) {
id = std::move(_id);
id->GetOptInfo()->SetTemp();
}
void Deactivate() { active = false; }
bool IsActive() const { return active; }
// Associated constant expression, if any.
const ConstExpr* Const() const { return id->GetOptInfo()->Const(); }
// Associated constant expression, if any.
const ConstExpr* Const() const { return id->GetOptInfo()->Const(); }
// The most use of "const" in any single line in the Zeek
// codebase :-P ... though only by one!
void SetConst(const ConstExpr* _const) { id->GetOptInfo()->SetConst(_const); }
// The most use of "const" in any single line in the Zeek
// codebase :-P ... though only by one!
void SetConst(const ConstExpr* _const) { id->GetOptInfo()->SetConst(_const); }
IDPtr Alias() const { return alias; }
void SetAlias(IDPtr id);
IDPtr Alias() const { return alias; }
void SetAlias(IDPtr id);
protected:
std::string name;
IDPtr id;
const TypePtr& type;
ExprPtr rhs;
bool active = true;
IDPtr alias;
};
std::string name;
IDPtr id;
const TypePtr& type;
ExprPtr rhs;
bool active = true;
IDPtr alias;
};
} // zeek::detail
} // namespace zeek::detail