[PATCH] D78050: Introduce `__sanitizer::ArrayRef<T>` type.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 12:03:56 PDT 2020


delcypher added a comment.

In D78050#1981672 <https://reviews.llvm.org/D78050#1981672>, @dblaikie wrote:

> Don't suppose there's any sane way to reuse any part of the main llvm version? Might at least be worth a few comments encouraging future developers to try to keep this mostly aligned with the llvm one? (maybe document broadly the features/etc that are omitted from this version but present in the llvm one)


We can't depend on libcxx in the compiler-rt runtimes. There's probably something crazy we could with macros that fudge the types to make it work but that doesn't sound sane.

> Is this more or less copy/paste, except for some features that aren't supportable/suitable for this usage?

Not really. It just has the bare minimum functionality that I needed. I only looked at `ArrayRef<>` when I needed to do something I didn't know how to implement.



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_mutable_array_ref.h:81
+    CHECK_LE(n, size());
+    T *slice_begin = const_cast<T *>(begin()) + n;
+    uptr slice_size = size() - n;
----------------
dblaikie wrote:
> Going to use `data()` here?
Oh sorry. I missed this. I'll fix this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78050





More information about the llvm-commits mailing list