aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-03-18 14:44:15 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-03-19 08:44:25 +0000
commit196476601e64a954ad10fb0a728038aedae93155 (patch)
tree331a288069dd4494f5fbe9beb54a124dfa854bdc
parentda073ad52c454230d3f9fead07270bc2b3d1f0ad (diff)
downloadgcc-196476601e64a954ad10fb0a728038aedae93155.zip
gcc-196476601e64a954ad10fb0a728038aedae93155.tar.gz
gcc-196476601e64a954ad10fb0a728038aedae93155.tar.bz2
Add TyTy::BaseType::debug interface
Calling debug() will printf akin to ctx->backend()->debug(tree). This makes debug information simpler when it comes to GDB sessions.
-rw-r--r--gcc/rust/typecheck/rust-tyty.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 2db65a6..9fe7417 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -101,6 +101,24 @@ public:
virtual bool has_subsititions_defined () const { return false; }
+ std::string mappings_str () const
+ {
+ std::string buffer = "Ref: " + std::to_string (get_ref ())
+ + " TyRef: " + std::to_string (get_ty_ref ());
+ buffer += "[";
+ for (auto &ref : combined)
+ buffer += std::to_string (ref) + ",";
+ buffer += "]";
+ return "(" + buffer + ")";
+ }
+
+ std::string debug_str () const
+ {
+ return as_string () + ":" + mappings_str ();
+ }
+
+ void debug () const { printf ("%s\n", debug_str ().c_str ()); }
+
protected:
BaseType (HirId ref, HirId ty_ref, TypeKind kind,
std::set<HirId> refs = std::set<HirId> ())