Add simple debug wrapper to dump HIR nodes on stderr.
Similar to what we already have for AST.
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::debug): New.
(debug): New.
* hir/rust-hir-dump.h (debug): New.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
return "unknown";
}
+/**
+ * Static member used to dump HIR from the debugger to stderr.
+ *
+ * @param v The HIR node to dump
+ */
+void
+Dump::debug (FullVisitable &v)
+{
+ Dump dump (std::cerr);
+ v.accept_vis (dump);
+}
+
void
Dump::go (HIR::Crate &e)
{
} // namespace HIR
} // namespace Rust
+
+// In the global namespace to make it easier to call from debugger
+void
+debug (Rust::HIR::FullVisitable &v)
+{
+ Rust::HIR::Dump::debug (v);
+}
class Dump : public HIRFullVisitor
{
public:
+ static void debug (FullVisitable &v);
+
Dump (std::ostream &stream);
void go (HIR::Crate &crate);
} // namespace HIR
} // namespace Rust
+// In the global namespace to make it easier to call from debugger
+void
+debug (Rust::HIR::FullVisitable &v);
+
#endif // !RUST_HIR_DUMP_H