Commit a9325a54 authored by Paul's avatar Paul
Browse files

Formating

parent 767d2885
......@@ -138,12 +138,14 @@ struct instruction
ins->recompute_shape();
}
static void replace(instruction_ref ins, operation o, const shape& r, std::vector<instruction_ref> args)
static void
replace(instruction_ref ins, operation o, const shape& r, std::vector<instruction_ref> args)
{
ins->replace(o, r, std::move(args));
backreference(ins);
}
private:
private:
// internal
void replace(operation o, const shape& r, std::vector<instruction_ref> args)
{
......
......@@ -290,7 +290,8 @@ argument generic_eval(const program& p,
else if(ins->name() == "@param")
{
results.emplace(ins, trace(ins, [&] {
return params.at(any_cast<builtin::param>(ins->get_operator()).parameter);
return params.at(
any_cast<builtin::param>(ins->get_operator()).parameter);
}));
}
else if(ins->name() == "@outline")
......@@ -305,8 +306,9 @@ argument generic_eval(const program& p,
assert(results.find(i) != results.end());
return results[i];
});
results.emplace(
ins, trace(ins, [&] { return ins->get_operator().compute(ctx, ins->get_shape(), values); }));
results.emplace(ins, trace(ins, [&] {
return ins->get_operator().compute(ctx, ins->get_shape(), values);
}));
}
assert(results.find(ins) != results.end());
}
......
......@@ -10,33 +10,36 @@
template <class Tag>
struct stowed
{
static typename Tag::type value;
};
template <class Tag>
static typename Tag::type value;
};
template <class Tag>
typename Tag::type stowed<Tag>::value;
template <class Tag, typename Tag::type x>
struct stow_private
{
stow_private() { stowed<Tag>::value = x; }
static stow_private instance;
stow_private() { stowed<Tag>::value = x; }
static stow_private instance;
};
template <class Tag, typename Tag::type x>
stow_private<Tag,x> stow_private<Tag,x>::instance;
template <class Tag, typename Tag::type x>
stow_private<Tag, x> stow_private<Tag, x>::instance;
template<class C, class T>
struct mem_data_ptr { typedef T(C::*type); };
template <class C, class T>
struct mem_data_ptr
{
typedef T(C::*type);
};
#define MIGRAPH_ROB(name, Type, C, mem) \
struct name ## _tag \
: mem_data_ptr<C, Type> \
{}; \
template struct stow_private<name ## _tag,&C::mem>; \
template<class T> \
auto& name(T&& x) \
{ \
return x.*stowed<name ## _tag>::value; \
}
#define MIGRAPH_ROB(name, Type, C, mem) \
struct name##_tag : mem_data_ptr<C, Type> \
{ \
}; \
template struct stow_private<name##_tag, &C::mem>; \
template <class T> \
auto& name(T&& x) \
{ \
return x.*stowed<name##_tag>::value; \
}
#ifdef __clang__
#pragma clang diagnostic pop
......
......@@ -39,7 +39,10 @@ void incomplete_args()
EXPECT(bool{p.validate() == ins});
}
MIGRAPH_ROB(access_ins_arguments, std::vector<migraph::instruction_ref>, migraph::instruction, arguments)
MIGRAPH_ROB(access_ins_arguments,
std::vector<migraph::instruction_ref>,
migraph::instruction,
arguments)
void invalid_args()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment