[PATCH] D123201: [demangler] Buffer peeking needs buffer

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 04:44:39 PDT 2022


urnathan updated this revision to Diff 425181.
urnathan added a comment.

rebase & ping?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123201/new/

https://reviews.llvm.org/D123201

Files:
  libcxxabi/src/demangle/Utility.h
  llvm/include/llvm/Demangle/Utility.h


Index: llvm/include/llvm/Demangle/Utility.h
===================================================================
--- llvm/include/llvm/Demangle/Utility.h
+++ llvm/include/llvm/Demangle/Utility.h
@@ -167,7 +167,8 @@
   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; }
Index: libcxxabi/src/demangle/Utility.h
===================================================================
--- libcxxabi/src/demangle/Utility.h
+++ libcxxabi/src/demangle/Utility.h
@@ -167,7 +167,8 @@
   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; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123201.425181.patch
Type: text/x-patch
Size: 1008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220426/88e86256/attachment.bin>


More information about the llvm-commits mailing list