[compiler-rt] 1310c68 - [sanitizer][NFC] Don't inherit InternalMmapVector
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 03:57:55 PDT 2021
Author: Vitaly Buka
Date: 2021-03-16T03:57:46-07:00
New Revision: 1310c686c25e237844c927d7bf777aa26b0bac1f
URL: https://github.com/llvm/llvm-project/commit/1310c686c25e237844c927d7bf777aa26b0bac1f
DIFF: https://github.com/llvm/llvm-project/commit/1310c686c25e237844c927d7bf777aa26b0bac1f.diff
LOG: [sanitizer][NFC] Don't inherit InternalMmapVector
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
index 2fecc3b4bf7c..e8a15556d161 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -592,20 +592,26 @@ class InternalMmapVector : public InternalMmapVectorNoCtor<T> {
InternalMmapVector &operator=(InternalMmapVector &&) = delete;
};
-class InternalScopedString : public InternalMmapVector<char> {
+class InternalScopedString {
public:
explicit InternalScopedString(uptr max_length)
- : InternalMmapVector<char>(max_length), length_(0) {
- (*this)[0] = '\0';
+ : buffer_(max_length), length_(0) {
+ buffer_[0] = '\0';
}
- uptr length() { return length_; }
+ uptr size() const { return buffer_.size(); }
+ uptr length() const { return length_; }
void clear() {
(*this)[0] = '\0';
length_ = 0;
}
void append(const char *format, ...);
+ char *data() { return buffer_.data(); }
+ const char *data() const { return buffer_.data(); }
+ char &operator[](uptr i) { return buffer_[i]; }
+ const char &operator[](uptr i) const { return buffer_[i]; }
private:
+ InternalMmapVector<char> buffer_;
uptr length_;
};
More information about the llvm-commits
mailing list