]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stacked-contexts: Add peek() method
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 26 Nov 2024 16:34:37 +0000 (16:34 +0000)
committerCohenArthur <arthur.cohen@embecosm.com>
Mon, 2 Dec 2024 14:35:30 +0000 (14:35 +0000)
gcc/rust/ChangeLog:

* util/rust-stacked-contexts.h: Add new method to see what context we are currently in.

gcc/rust/util/rust-stacked-contexts.h

index 86cdf9f88d2aec8002c38d984840bc3f3e8c7543..d537d6ec451bfc7c6e27656d1e7de246a2ae63ee 100644 (file)
@@ -71,6 +71,13 @@ public:
     return last;
   }
 
+  const T &peek ()
+  {
+    rust_assert (!stack.empty ());
+
+    return stack.back ();
+  }
+
   /**
    * Are we currently inside of a special context?
    */