aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-11-26 16:34:37 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-21 12:33:06 +0100
commitaa784e818c2712c6fabe749919d455d995688cf6 (patch)
treef8f36a49d7affb83b1359e1a461639bebbd38fd4 /gcc
parente7bf1b6291ea18a3848f9fc7d44421554eeafe4f (diff)
downloadgcc-aa784e818c2712c6fabe749919d455d995688cf6.zip
gcc-aa784e818c2712c6fabe749919d455d995688cf6.tar.gz
gcc-aa784e818c2712c6fabe749919d455d995688cf6.tar.bz2
gccrs: stacked-contexts: Add peek() method
gcc/rust/ChangeLog: * util/rust-stacked-contexts.h: Add new method to see what context we are currently in.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/util/rust-stacked-contexts.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-stacked-contexts.h b/gcc/rust/util/rust-stacked-contexts.h
index 39a0c08..fe0bc8a 100644
--- a/gcc/rust/util/rust-stacked-contexts.h
+++ b/gcc/rust/util/rust-stacked-contexts.h
@@ -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?
*/