Use wpi::span instead of wpi::ArrayRef across all libraries (#3414)

- Remove ArrayRef.h
- Add SpanExtras.h for a couple of convenience functions
This commit is contained in:
Peter Johnson
2021-06-06 19:51:14 -07:00
committed by GitHub
parent 2abbbd9e70
commit 64f5413253
167 changed files with 974 additions and 1433 deletions

View File

@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "wpi/ConvertUTF.h"
#include "wpi/SmallVector.h"
#include <string>
#include <vector>
@@ -28,13 +29,13 @@ bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr) {
return true;
}
bool hasUTF16ByteOrderMark(ArrayRef<char> S) {
bool hasUTF16ByteOrderMark(span<const char> S) {
return (S.size() >= 2 &&
((S[0] == '\xff' && S[1] == '\xfe') ||
(S[0] == '\xfe' && S[1] == '\xff')));
}
bool convertUTF16ToUTF8String(ArrayRef<UTF16> SrcUTF16,
bool convertUTF16ToUTF8String(span<const UTF16> SrcUTF16,
SmallVectorImpl<char> &DstUTF8) {
assert(DstUTF8.empty());

View File

@@ -15,6 +15,7 @@
#include "wpi/SmallPtrSet.h"
#include "wpi/DenseMapInfo.h"
#include "wpi/MathExtras.h"
#include "wpi/MemAlloc.h"
#include "wpi/ErrorHandling.h"
#include <algorithm>
#include <cassert>