summaryrefslogtreecommitdiff
path: root/runtime/base/stringpiece.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/base/stringpiece.h')
-rw-r--r--runtime/base/stringpiece.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/runtime/base/stringpiece.h b/runtime/base/stringpiece.h
index 46743e9643..e7109dc18a 100644
--- a/runtime/base/stringpiece.h
+++ b/runtime/base/stringpiece.h
@@ -20,6 +20,8 @@
#include <string.h>
#include <string>
+#include <android-base/logging.h>
+
namespace art {
// A string-like object that points to a sized piece of memory.
@@ -84,13 +86,10 @@ class StringPiece {
length_ = len;
}
-#if defined(NDEBUG)
char operator[](size_type i) const {
+ DCHECK_LT(i, length_);
return ptr_[i];
}
-#else
- char operator[](size_type i) const;
-#endif
void remove_prefix(size_type n) {
ptr_ += n;