5#ifndef V8_TORQUE_CPP_BUILDER_H_
6#define V8_TORQUE_CPP_BUILDER_H_
21 : name(
std::move(name)), type(
std::move(type)) {}
30 Class(std::vector<TemplateParameter> template_parameters, std::string name)
44#define FUNCTION_FLAG_LIST(V) \
56#define ENTRY(name, value) k##name = value,
68 : type(
std::move(type)),
69 name(
std::move(name)),
74 :
pos_(CurrentSourcePosition::
Get()),
78 :
pos_(CurrentSourcePosition::
Get()),
86 getter.SetReturnType(std::move(return_type));
93 std::string parameter_type,
94 std::string parameter_name) {
96 setter.SetReturnType(
"void");
97 setter.AddParameter(std::move(parameter_type), std::move(parameter_name));
117#define ACCESSOR(name, value) \
118 void Set##name(bool v = true) { SetFlag(k##name, v); } \
119 bool Is##name() const { return HasFlag(k##name); }
131 std::string default_value = {}) {
132 parameters_.emplace_back(std::move(type), std::move(name),
133 std::move(default_value));
136 std::string default_value = {}) {
141 Parameter(std::move(type), std::move(name), std::move(default_value)));
145 std::vector<std::string> names;
147 std::back_inserter(names),
148 [](
const Parameter& p) { return p.name; });
156 const std::function<
void(std::ostream&)>& builder,
157 int indentation = 0)
const;
159 const std::function<
void(std::ostream&)>& builder,
160 int indentation = 2)
const;
178#undef FUNCTION_FLAG_LIST
189 void EndNamespace(
const std::string& name0,
const std::string& name1);
193 template <
typename T>
217 std::swap(
file_, other.file_);
218 std::swap(
name_, other.name_);
227 if (
this != &other) {
230 std::swap(
file_, other.file_);
231 std::swap(
name_, other.name_);
#define DEFINE_OPERATORS_FOR_FLAGS(Type)
Flags without(flag_type flag) const
std::string GetName() const
Class(std::vector< TemplateParameter > template_parameters, std::string name)
std::vector< TemplateParameter > template_parameters_
std::vector< TemplateParameter > GetTemplateParameters() const
void EndIncludeGuard(const std::string &name)
File(std::ostream &stream)
File & operator<<(const T &value)
std::stack< std::string > namespaces_
void AddInclude(std::string include)
void BeginIncludeGuard(const std::string &name)
void EndNamespace(const std::string &name)
std::set< std::string > includes_
void BeginNamespace(std::string name)
std::vector< Parameter > GetParameters() const
void AddParameter(std::string type, std::string name={}, std::string default_value={})
Function(std::string name)
void PrintDeclaration(std::ostream &stream, int indentation=kAutomaticIndentation) const
bool HasFlag(FunctionFlag flag) const
void InsertParameter(int index, std::string type, std::string name={}, std::string default_value={})
std::vector< std::string > GetParameterNames() const
void PrintEndDefinition(std::ostream &stream, int indentation=0) const
static constexpr int kAutomaticIndentation
void SetName(std::string name)
base::Flags< FunctionFlag > flags_
void SetFlag(FunctionFlag flag, bool value=true)
void PrintInlineDefinition(std::ostream &stream, const std::function< void(std::ostream &)> &builder, int indentation=2) const
void SetFlags(base::Flags< FunctionFlag > flags, bool value=true)
void PrintBeginDefinition(std::ostream &stream, int indentation=0) const
static Function DefaultSetter(Class *owner, std::string name, std::string parameter_type, std::string parameter_name)
void PrintDeclarationHeader(std::ostream &stream, int indentation) const
static Function DefaultGetter(std::string return_type, Class *owner, std::string name)
std::vector< Parameter > parameters_
void PrintDefinition(std::ostream &stream, const std::function< void(std::ostream &)> &builder, int indentation=0) const
void SetReturnType(std::string return_type)
Function(Class *owning_class, std::string name)
void SetDescription(std::string description)
IncludeGuardScope & operator=(const IncludeGuardScope &)=delete
IncludeGuardScope & operator=(IncludeGuardScope &&other) V8_NOEXCEPT
IncludeGuardScope(IncludeGuardScope &&other) V8_NOEXCEPT
IncludeGuardScope(const IncludeGuardScope &)=delete
IncludeGuardScope(File *file, std::string name)
#define FUNCTION_FLAG_LIST(V)
#define ACCESSOR(name, value)
V8_INLINE const Operation & Get(const Graph &graph, OpIndex index)
#define DCHECK_LE(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
Parameter(std::string type, std::string name, std::string default_value={})
std::string default_value
TemplateParameter(std::string name)
TemplateParameter(std::string type, std::string name)