public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Add helper as_string for DefIds
@ 2022-06-08 12:26 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b1f42c38f59f43c5f8377aebb9f759bc9cd768c3

commit b1f42c38f59f43c5f8377aebb9f759bc9cd768c3
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Wed Mar 30 14:50:18 2022 +0100

    Add helper as_string for DefIds

Diff:
---
 gcc/rust/util/rust-mapping-common.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/rust/util/rust-mapping-common.h b/gcc/rust/util/rust-mapping-common.h
index 42a4e8eeacb..b4380f17c3e 100644
--- a/gcc/rust/util/rust-mapping-common.h
+++ b/gcc/rust/util/rust-mapping-common.h
@@ -50,6 +50,14 @@ struct DefId
     return ((uint64_t) this->crateNum << 32 | this->localDefId)
 	   < ((uint64_t) other.crateNum << 32 | other.localDefId);
   }
+
+  std::string as_string () const
+  {
+    std::string buf;
+    buf += std::to_string (crateNum);
+    buf += std::to_string (localDefId);
+    return buf;
+  }
 };
 
 #define UNKNOWN_CREATENUM ((uint32_t) (0))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:26 [gcc/devel/rust/master] Add helper as_string for DefIds Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).