25#ifndef TVM_IR_WITH_CONTEXT_H_
26#define TVM_IR_WITH_CONTEXT_H_
58template <
typename ContextType>
65 template <
typename...
Args>
67 ctx_.EnterWithScope();
113template <
typename ContextType>
126 template <
typename...
Args>
128 entries_.push_back(std::make_unique<
With<ContextType>>(std::forward<Args>(args)...));
132 size_t size()
const {
return entries_.size(); }
145 bool unwinding = std::uncaught_exceptions() > 0;
147 while (!entries_.empty()) {
150 auto entry = std::move(entries_.back());
164 std::vector<std::unique_ptr<With<ContextType>>> entries_;
A group of RAII contexts managed together.
Definition with_context.h:114
~WithGroup() noexcept(false)
Destructor — exits all contexts in reverse order.
Definition with_context.h:144
WithGroup(const WithGroup &)=delete
WithGroup & operator=(const WithGroup &)=delete
void Emplace(Args &&... args)
Construct a context and enter its scope.
Definition with_context.h:127
WithGroup & operator=(WithGroup &&)=default
WithGroup(WithGroup &&)=default
size_t size() const
Number of active contexts in this group.
Definition with_context.h:132
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
With(Args &&... args)
constructor. Enter the scope of the context.
Definition with_context.h:66
With(With &&other)=delete
ContextType * operator->()
Definition with_context.h:84
ContextType operator()()
Definition with_context.h:89
With(const With &other)=delete
const ContextType * operator*() const
Definition with_context.h:87
const ContextType * get() const
Definition with_context.h:82
~With() noexcept(false)
destructor, leaves the scope of the context.
Definition with_context.h:70
ContextType & operator*()
Definition with_context.h:86
With & operator=(With &&other)=delete
const ContextType * operator->() const
Definition with_context.h:85
ContextType * get()
Definition with_context.h:81
With & operator=(const With &other)=delete
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40