summaryrefslogtreecommitdiff
path: root/libcxxabi/src
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2022-03-28 12:38:48 -0700
committerNathan Sidwell <nathan@acm.org>2022-05-09 04:17:22 -0700
commite48cd7088b736dae5cd572ebb58963c70a4a72b8 (patch)
tree7f756d86c0d9b61a5919cc401973342ca28d1fc0 /libcxxabi/src
parent8a92c45e07dc81c83ca3afda3971d98c512429d4 (diff)
downloadllvm-e48cd7088b736dae5cd572ebb58963c70a4a72b8.tar.gz
[demangler] Buffer peeking needs buffer
The output buffer has a 'back' member, which returns NUL when you try it with an empty buffer. But there are no use cases that need that additional functionality. This makes the 'back' member behave more like STL containers' back members. (It still returns a value, not a reference.) Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123201
Diffstat (limited to 'libcxxabi/src')
-rw-r--r--libcxxabi/src/demangle/Utility.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcxxabi/src/demangle/Utility.h b/libcxxabi/src/demangle/Utility.h
index 6e0fa38632c8..db19dcac0147 100644
--- a/libcxxabi/src/demangle/Utility.h
+++ b/libcxxabi/src/demangle/Utility.h
@@ -171,7 +171,8 @@ public:
void setCurrentPosition(size_t NewPos) { CurrentPosition = NewPos; }
char back() const {
- return CurrentPosition ? Buffer[CurrentPosition - 1] : '\0';
+ assert(CurrentPosition);
+ return Buffer[CurrentPosition - 1];
}
bool empty() const { return CurrentPosition == 0; }