Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part

Use deduction guides instead of helper functions.

The only non-automatic changes have been:

1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*))
2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase.
3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated.
4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that).

Per reviewers' comment, some useless makeArrayRef have been removed in the process.

This is a follow-up to https://reviews.llvm.org/D140896 that introduced
the deduction guides.

Differential Revision: https://reviews.llvm.org/D140955
This commit is contained in:
serge-sans-paille 2023-01-04 08:28:45 +01:00
parent 11be5cc001
commit 38818b60c5
No known key found for this signature in database
GPG Key ID: 7B24DA8C9551659F
270 changed files with 981 additions and 1044 deletions

View File

@ -776,7 +776,7 @@ is guarded by ``GET_ATable_DECL``, while the definitions are guarded by
uint16_t Val2;
};
KeyType Key = { Val1, Val2 };
auto Table = makeArrayRef(ATable);
auto Table = ArrayRef(ATable);
auto Idx = std::lower_bound(Table.begin(), Table.end(), Key,
[](const AEntry &LHS, const KeyType &RHS) {
if (LHS.Val1 < RHS.Val1)
@ -850,7 +850,7 @@ Here is the generated C++ code.
uint16_t Encoding;
};
KeyType Key = { Encoding };
auto Table = makeArrayRef(CTable);
auto Table = ArrayRef(CTable);
auto Idx = std::lower_bound(Table.begin(), Table.end(), Key,
[](const CEntry &LHS, const KeyType &RHS) {
if (LHS.Encoding < RHS.Encoding)
@ -948,7 +948,7 @@ This use of ``SearchIndex`` generates the following additional C++ code.
unsigned Kind;
};
KeyType Key = { Name.upper(), Kind };
auto Table = makeArrayRef(Index);
auto Table = ArrayRef(Index);
auto Idx = std::lower_bound(Table.begin(), Table.end(), Key,
[](const IndexType &LHS, const KeyType &RHS) {
int CmpName = StringRef(LHS.Name).compare(RHS.Name);

View File

@ -687,7 +687,7 @@ public:
if (!isSmall())
return getPointer()->getData();
Store = getSmallBits();
return makeArrayRef(Store);
return Store;
}
private:

View File

@ -40,7 +40,7 @@ public:
assert(Constraints.empty() || R.size() == Constraints.back().size());
// If all variable coefficients are 0, the constraint does not provide any
// usable information.
if (all_of(makeArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
if (all_of(ArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
return false;
for (const auto &C : R) {
@ -55,7 +55,7 @@ public:
bool addVariableRowFill(ArrayRef<int64_t> R) {
// If all variable coefficients are 0, the constraint does not provide any
// usable information.
if (all_of(makeArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
if (all_of(ArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
return false;
for (auto &CR : Constraints) {

View File

@ -187,7 +187,7 @@ protected:
SCEVNAryExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T,
const SCEV *const *O, size_t N)
: SCEV(ID, T, computeExpressionSize(makeArrayRef(O, N))), Operands(O),
: SCEV(ID, T, computeExpressionSize(ArrayRef(O, N))), Operands(O),
NumOperands(N) {}
public:
@ -199,7 +199,7 @@ public:
}
ArrayRef<const SCEV *> operands() const {
return makeArrayRef(Operands, NumOperands);
return ArrayRef(Operands, NumOperands);
}
NoWrapFlags getNoWrapFlags(NoWrapFlags Mask = NoWrapMask) const {

View File

@ -429,7 +429,7 @@ public:
/// in the buffer and should be handled separately by the caller.
template <typename BufferTy, typename... Data>
static void readRecord(BufferTy &buffer, Data &&...data) {
return readRecord(llvm::makeArrayRef(buffer), std::forward<Data>(data)...);
return readRecord(llvm::ArrayRef(buffer), std::forward<Data>(data)...);
}
};

View File

@ -474,7 +474,7 @@ public:
Out.push_back(0);
}
void emitBlob(StringRef Bytes, bool ShouldEmitSize = true) {
emitBlob(makeArrayRef((const uint8_t *)Bytes.data(), Bytes.size()),
emitBlob(ArrayRef((const uint8_t *)Bytes.data(), Bytes.size()),
ShouldEmitSize);
}
@ -485,7 +485,7 @@ public:
if (!Abbrev) {
// If we don't have an abbrev to use, emit this in its fully unabbreviated
// form.
auto Count = static_cast<uint32_t>(makeArrayRef(Vals).size());
auto Count = static_cast<uint32_t>(ArrayRef(Vals).size());
EmitCode(bitc::UNABBREV_RECORD);
EmitVBR(Code, 6);
EmitVBR(Count, 6);
@ -494,7 +494,7 @@ public:
return;
}
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(), Code);
EmitRecordWithAbbrevImpl(Abbrev, ArrayRef(Vals), StringRef(), Code);
}
/// EmitRecordWithAbbrev - Emit a record with the specified abbreviation.
@ -502,8 +502,7 @@ public:
/// the first entry.
template <typename Container>
void EmitRecordWithAbbrev(unsigned Abbrev, const Container &Vals) {
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(),
std::nullopt);
EmitRecordWithAbbrevImpl(Abbrev, ArrayRef(Vals), StringRef(), std::nullopt);
}
/// EmitRecordWithBlob - Emit the specified record to the stream, using an
@ -514,12 +513,12 @@ public:
template <typename Container>
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
StringRef Blob) {
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, std::nullopt);
EmitRecordWithAbbrevImpl(Abbrev, ArrayRef(Vals), Blob, std::nullopt);
}
template <typename Container>
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
const char *BlobData, unsigned BlobLen) {
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
return EmitRecordWithAbbrevImpl(Abbrev, ArrayRef(Vals),
StringRef(BlobData, BlobLen), std::nullopt);
}
@ -528,14 +527,13 @@ public:
template <typename Container>
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
StringRef Array) {
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Array, std::nullopt);
EmitRecordWithAbbrevImpl(Abbrev, ArrayRef(Vals), Array, std::nullopt);
}
template <typename Container>
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
const char *ArrayData, unsigned ArrayLen) {
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
StringRef(ArrayData, ArrayLen),
std::nullopt);
return EmitRecordWithAbbrevImpl(
Abbrev, ArrayRef(Vals), StringRef(ArrayData, ArrayLen), std::nullopt);
}
//===--------------------------------------------------------------------===//

View File

@ -47,7 +47,7 @@ template <size_t N, class CostType>
inline const CostTblEntryT<CostType> *
CostTableLookup(const CostTblEntryT<CostType> (&Table)[N], int ISD, MVT Ty) {
// Wrapper to fix template argument deduction failures.
return CostTableLookup<CostType>(makeArrayRef(Table), ISD, Ty);
return CostTableLookup<CostType>(Table, ISD, Ty);
}
/// Type Conversion Cost Table
@ -81,7 +81,7 @@ inline const TypeConversionCostTblEntryT<CostType> *
ConvertCostTableLookup(const TypeConversionCostTblEntryT<CostType> (&Table)[N],
int ISD, MVT Dst, MVT Src) {
// Wrapper to fix template argument deduction failures.
return ConvertCostTableLookup<CostType>(makeArrayRef(Table), ISD, Dst, Src);
return ConvertCostTableLookup<CostType>(Table, ISD, Dst, Src);
}
} // namespace llvm

View File

@ -163,9 +163,7 @@ public:
/// we want to drop it from the NewRegs set.
void pop_back() { NewRegs.pop_back(); }
ArrayRef<Register> regs() const {
return makeArrayRef(NewRegs).slice(FirstNew);
}
ArrayRef<Register> regs() const { return ArrayRef(NewRegs).slice(FirstNew); }
/// createFrom - Create a new virtual register based on OldReg.
Register createFrom(Register OldReg);

View File

@ -188,7 +188,7 @@ private:
}
ArrayRef<MachineMemOperand *> getMMOs() const {
return makeArrayRef(getTrailingObjects<MachineMemOperand *>(), NumMMOs);
return ArrayRef(getTrailingObjects<MachineMemOperand *>(), NumMMOs);
}
MCSymbol *getPreInstrSymbol() const {
@ -715,7 +715,7 @@ public:
return {};
if (Info.is<EIIK_MMO>())
return makeArrayRef(Info.getAddrOfZeroTagPointer(), 1);
return ArrayRef(Info.getAddrOfZeroTagPointer(), 1);
if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
return EI->getMMOs();

View File

@ -38,7 +38,7 @@ class RegisterClassInfo {
RCInfo() = default;
operator ArrayRef<MCPhysReg>() const {
return makeArrayRef(Order.get(), NumRegs);
return ArrayRef(Order.get(), NumRegs);
}
};

View File

@ -783,7 +783,7 @@ public:
SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Glue };
return getNode(ISD::CopyToReg, dl, VTs,
makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
ArrayRef(Ops, Glue.getNode() ? 4 : 3));
}
// Similar to last getCopyToReg() except parameter Reg is a SDValue
@ -792,7 +792,7 @@ public:
SDVTList VTs = getVTList(MVT::Other, MVT::Glue);
SDValue Ops[] = { Chain, Reg, N, Glue };
return getNode(ISD::CopyToReg, dl, VTs,
makeArrayRef(Ops, Glue.getNode() ? 4 : 3));
ArrayRef(Ops, Glue.getNode() ? 4 : 3));
}
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT) {
@ -809,7 +809,7 @@ public:
SDVTList VTs = getVTList(VT, MVT::Other, MVT::Glue);
SDValue Ops[] = { Chain, getRegister(Reg, VT), Glue };
return getNode(ISD::CopyFromReg, dl, VTs,
makeArrayRef(Ops, Glue.getNode() ? 3 : 2));
ArrayRef(Ops, Glue.getNode() ? 3 : 2));
}
SDValue getCondCode(ISD::CondCode Cond);

View File

@ -927,7 +927,7 @@ public:
op_iterator op_begin() const { return OperandList; }
op_iterator op_end() const { return OperandList+NumOperands; }
ArrayRef<SDUse> ops() const { return makeArrayRef(op_begin(), op_end()); }
ArrayRef<SDUse> ops() const { return ArrayRef(op_begin(), op_end()); }
/// Iterator for directly iterating over the operand SDValue's.
struct value_op_iterator
@ -1535,7 +1535,7 @@ protected:
public:
ArrayRef<int> getMask() const {
EVT VT = getValueType(0);
return makeArrayRef(Mask, VT.getVectorNumElements());
return ArrayRef(Mask, VT.getVectorNumElements());
}
int getMaskElt(unsigned Idx) const {
@ -2931,10 +2931,10 @@ public:
if (NumMemRefs == 0)
return {};
if (NumMemRefs == 1)
return makeArrayRef(MemRefs.getAddrOfPtr1(), 1);
return ArrayRef(MemRefs.getAddrOfPtr1(), 1);
// Otherwise we have an actual array.
return makeArrayRef(MemRefs.get<MachineMemOperand **>(), NumMemRefs);
return ArrayRef(MemRefs.get<MachineMemOperand **>(), NumMemRefs);
}
mmo_iterator memoperands_begin() const { return memoperands().begin(); }
mmo_iterator memoperands_end() const { return memoperands().end(); }

View File

@ -200,7 +200,7 @@ public:
///
/// By default, this method returns all registers in the class.
ArrayRef<MCPhysReg> getRawAllocationOrder(const MachineFunction &MF) const {
return OrderFunc ? OrderFunc(MF) : makeArrayRef(begin(), getNumRegs());
return OrderFunc ? OrderFunc(MF) : ArrayRef(begin(), getNumRegs());
}
/// Returns the combination of all lane masks of register in this class.
@ -357,7 +357,7 @@ public:
unsigned NumRegs = getNumRegs();
assert(Idx < InfoDesc->NumCosts && "CostPerUse index out of bounds");
return makeArrayRef(&InfoDesc->CostPerUse[Idx * NumRegs], NumRegs);
return ArrayRef(&InfoDesc->CostPerUse[Idx * NumRegs], NumRegs);
}
/// Return true if the register is in the allocation of any register class.

View File

@ -704,10 +704,10 @@ public:
TypeIndex getCompleteClass() const { return CompleteClass; }
TypeIndex getOverriddenVTable() const { return OverriddenVFTable; }
uint32_t getVFPtrOffset() const { return VFPtrOffset; }
StringRef getName() const { return makeArrayRef(MethodNames).front(); }
StringRef getName() const { return ArrayRef(MethodNames).front(); }
ArrayRef<StringRef> getMethodNames() const {
return makeArrayRef(MethodNames).drop_front();
return ArrayRef(MethodNames).drop_front();
}
TypeIndex CompleteClass;

View File

@ -164,11 +164,11 @@ public:
const Entry *getFromHash(uint64_t Offset) const;
ArrayRef<DWARFSectionKind> getColumnKinds() const {
return makeArrayRef(ColumnKinds.get(), Header.NumColumns);
return ArrayRef(ColumnKinds.get(), Header.NumColumns);
}
ArrayRef<Entry> getRows() const {
return makeArrayRef(Rows.get(), Header.NumBuckets);
return ArrayRef(Rows.get(), Header.NumBuckets);
}
};

View File

@ -108,9 +108,7 @@ public:
unsigned getModuleIndex() const { return Layout.Mod; }
ArrayRef<std::string> source_files() const {
return makeArrayRef(SourceFiles);
}
ArrayRef<std::string> source_files() const { return SourceFiles; }
uint32_t calculateSerializedLength() const;

View File

@ -698,7 +698,7 @@ public:
/// ArrayRef<ElementTy>. Calls get(LLVMContext, ArrayRef<ElementTy>).
template <typename ArrayTy>
static Constant *get(LLVMContext &Context, ArrayTy &Elts) {
return ConstantDataArray::get(Context, makeArrayRef(Elts));
return ConstantDataArray::get(Context, ArrayRef(Elts));
}
/// getRaw() constructor - Return a constant with array type with an element
@ -1247,7 +1247,7 @@ public:
std::optional<unsigned> InRangeIndex = std::nullopt,
Type *OnlyIfReducedTy = nullptr) {
return getGetElementPtr(
Ty, C, makeArrayRef((Value *const *)IdxList.data(), IdxList.size()),
Ty, C, ArrayRef((Value *const *)IdxList.data(), IdxList.size()),
InBounds, InRangeIndex, OnlyIfReducedTy);
}
static Constant *

View File

@ -646,7 +646,7 @@ public:
}
ArrayRef<uint64_t> getMemberOffsets() const {
return llvm::makeArrayRef(getTrailingObjects<uint64_t>(), NumElements);
return llvm::ArrayRef(getTrailingObjects<uint64_t>(), NumElements);
}
uint64_t getElementOffset(unsigned Idx) const {

View File

@ -128,7 +128,7 @@ public:
param_iterator param_begin() const { return ContainedTys + 1; }
param_iterator param_end() const { return &ContainedTys[NumContainedTys]; }
ArrayRef<Type *> params() const {
return makeArrayRef(param_begin(), param_end());
return ArrayRef(param_begin(), param_end());
}
/// Parameter type accessors.
@ -317,7 +317,7 @@ public:
element_iterator element_begin() const { return ContainedTys; }
element_iterator element_end() const { return &ContainedTys[NumContainedTys];}
ArrayRef<Type *> elements() const {
return makeArrayRef(element_begin(), element_end());
return ArrayRef(element_begin(), element_end());
}
/// Return true if this is layout identical to the specified struct.
@ -761,7 +761,7 @@ public:
/// Return the type parameters for this particular target extension type. If
/// there are no parameters, an empty array is returned.
ArrayRef<Type *> type_params() const {
return makeArrayRef(type_param_begin(), type_param_end());
return ArrayRef(type_param_begin(), type_param_end());
}
using type_param_iterator = Type::subtype_iterator;
@ -776,7 +776,7 @@ public:
/// Return the integer parameters for this particular target extension type.
/// If there are no parameters, an empty array is returned.
ArrayRef<unsigned> int_params() const {
return makeArrayRef(IntParams, getNumIntParameters());
return ArrayRef(IntParams, getNumIntParameters());
}
unsigned getIntParameter(unsigned i) const { return IntParams[i]; }

View File

@ -830,7 +830,7 @@ public:
const Twine &Name = "");
/// Conveninence function for the common case when CallArgs are filled
/// in using makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
/// in using ArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
/// .get()'ed to get the Value pointer.
CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualCallee,
@ -858,7 +858,7 @@ public:
const Twine &Name = "");
// Convenience function for the common case when CallArgs are filled in using
// makeArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be .get()'ed to
// ArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be .get()'ed to
// get the Value *.
InvokeInst *
CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
@ -1047,7 +1047,7 @@ public:
if (MDSrc) {
unsigned WL[4] = {LLVMContext::MD_prof, LLVMContext::MD_unpredictable,
LLVMContext::MD_make_implicit, LLVMContext::MD_dbg};
Br->copyMetadata(*MDSrc, makeArrayRef(&WL[0], 4));
Br->copyMetadata(*MDSrc, WL);
}
return Insert(Br);
}

View File

@ -327,7 +327,7 @@ public:
return dropUnknownNonDebugMetadata(std::nullopt);
}
void dropUnknownNonDebugMetadata(unsigned ID1) {
return dropUnknownNonDebugMetadata(makeArrayRef(ID1));
return dropUnknownNonDebugMetadata(ArrayRef(ID1));
}
void dropUnknownNonDebugMetadata(unsigned ID1, unsigned ID2) {
unsigned IDs[] = {ID1, ID2};

View File

@ -1034,8 +1034,8 @@ class MDNode : public Metadata {
ArrayRef<MDOperand> operands() const {
if (IsLarge)
return getLarge();
return makeArrayRef(reinterpret_cast<const MDOperand *>(this) - SmallSize,
SmallNumOps);
return ArrayRef(reinterpret_cast<const MDOperand *>(this) - SmallSize,
SmallNumOps);
}
unsigned getNumOperands() const {

View File

@ -64,7 +64,7 @@ private:
public:
size_t size(BasicBlock *BB) const { return GetNumPreds(BB); }
ArrayRef<BasicBlock *> get(BasicBlock *BB) {
return makeArrayRef(GetPreds(BB), GetNumPreds(BB));
return ArrayRef(GetPreds(BB), GetNumPreds(BB));
}
/// clear - Remove all information.

View File

@ -352,7 +352,7 @@ public:
subtype_iterator subtype_begin() const { return ContainedTys; }
subtype_iterator subtype_end() const { return &ContainedTys[NumContainedTys];}
ArrayRef<Type*> subtypes() const {
return makeArrayRef(subtype_begin(), subtype_end());
return ArrayRef(subtype_begin(), subtype_end());
}
using subtype_reverse_iterator = std::reverse_iterator<subtype_iterator>;

View File

@ -259,7 +259,7 @@ public:
Expected<Elf_Sym_Range> symbols(const Elf_Shdr *Sec) const {
if (!Sec)
return makeArrayRef<Elf_Sym>(nullptr, nullptr);
return ArrayRef<Elf_Sym>(nullptr, nullptr);
return getSectionContentsAsArray<Elf_Sym>(*Sec);
}
@ -296,7 +296,7 @@ public:
", e_phentsize = " + Twine(getHeader().e_phentsize));
auto *Begin = reinterpret_cast<const Elf_Phdr *>(base() + PhOff);
return makeArrayRef(Begin, Begin + getHeader().e_phnum);
return ArrayRef(Begin, Begin + getHeader().e_phnum);
}
/// Get an iterator over notes in a program header.
@ -516,7 +516,7 @@ ELFFile<ELFT>::getSectionContentsAsArray(const Elf_Shdr &Sec) const {
return createError("unaligned data");
const T *Start = reinterpret_cast<const T *>(base() + Offset);
return makeArrayRef(Start, Size / sizeof(T));
return ArrayRef(Start, Size / sizeof(T));
}
template <class ELFT>
@ -536,7 +536,7 @@ ELFFile<ELFT>::getSegmentContents(const Elf_Phdr &Phdr) const {
") + p_filesz (0x" + Twine::utohexstr(Size) +
") that is greater than the file size (0x" +
Twine::utohexstr(Buf.size()) + ")");
return makeArrayRef(base() + Offset, Size);
return ArrayRef(base() + Offset, Size);
}
template <class ELFT>
@ -798,7 +798,7 @@ Expected<typename ELFT::ShdrRange> ELFFile<ELFT>::sections() const {
const uintX_t SectionTableOffset = getHeader().e_shoff;
if (SectionTableOffset == 0) {
if (!FakeSections.empty())
return makeArrayRef(FakeSections.data(), FakeSections.size());
return ArrayRef(FakeSections.data(), FakeSections.size());
return ArrayRef<Elf_Shdr>();
}
@ -842,7 +842,7 @@ Expected<typename ELFT::ShdrRange> ELFFile<ELFT>::sections() const {
// Section table goes past end of file!
if (SectionTableOffset + SectionTableSize > FileSize)
return createError("section table goes past the end of file");
return makeArrayRef(First, NumSections);
return ArrayRef(First, NumSections);
}
template <class ELFT>

View File

@ -860,13 +860,12 @@ Expected<ArrayRef<uint8_t>>
ELFObjectFile<ELFT>::getSectionContents(DataRefImpl Sec) const {
const Elf_Shdr *EShdr = getSection(Sec);
if (EShdr->sh_type == ELF::SHT_NOBITS)
return makeArrayRef((const uint8_t *)base(), 0);
return ArrayRef((const uint8_t *)base(), (size_t)0);
if (Error E =
checkOffset(getMemoryBufferRef(),
(uintptr_t)base() + EShdr->sh_offset, EShdr->sh_size))
return std::move(E);
return makeArrayRef((const uint8_t *)base() + EShdr->sh_offset,
EShdr->sh_size);
return ArrayRef((const uint8_t *)base() + EShdr->sh_offset, EShdr->sh_size);
}
template <class ELFT>

View File

@ -486,7 +486,7 @@ struct ExceptionDataRecord {
ArrayRef<support::ulittle32_t> EpilogueScopes() const {
assert(E() == 0 && "epilogue scopes are only present when the E bit is 0");
size_t Offset = HeaderWords(*this);
return makeArrayRef(&Data[Offset], EpilogueCount());
return ArrayRef(&Data[Offset], EpilogueCount());
}
ArrayRef<uint8_t> UnwindByteCode() const {
@ -494,7 +494,7 @@ struct ExceptionDataRecord {
+ (E() ? 0 : EpilogueCount());
const uint8_t *ByteCode =
reinterpret_cast<const uint8_t *>(&Data[Offset]);
return makeArrayRef(ByteCode, CodeWords() * sizeof(uint32_t));
return ArrayRef(ByteCode, CodeWords() * sizeof(uint32_t));
}
uint32_t ExceptionHandlerRVA() const {

View File

@ -149,7 +149,7 @@ public:
if (auto EC = checkOffsetForWrite(Offset, Buffer.size()))
return EC;
Buffer = makeArrayRef(Data).slice(Offset, Size);
Buffer = ArrayRef(Data).slice(Offset, Size);
return Error::success();
}
@ -162,7 +162,7 @@ public:
if (auto EC = checkOffsetForWrite(Offset, 1))
return EC;
Buffer = makeArrayRef(Data).slice(Offset);
Buffer = ArrayRef(Data).slice(Offset);
return Error::success();
}

View File

@ -58,8 +58,8 @@ public:
/// Users of this function should pay attention to respect endianness
/// contraints.
void update(StringRef Data) {
update(makeArrayRef(reinterpret_cast<const uint8_t *>(Data.data()),
Data.size()));
update(
ArrayRef(reinterpret_cast<const uint8_t *>(Data.data()), Data.size()));
}
/// Forward to `HasherT::final()` if available.
@ -131,9 +131,8 @@ public:
add(Value.size());
if (hashbuilder_detail::IsHashableData<T>::value &&
Endianness == support::endian::system_endianness()) {
this->update(
makeArrayRef(reinterpret_cast<const uint8_t *>(Value.begin()),
Value.size() * sizeof(T)));
this->update(ArrayRef(reinterpret_cast<const uint8_t *>(Value.begin()),
Value.size() * sizeof(T)));
} else {
for (auto &V : Value)
add(V);
@ -160,8 +159,8 @@ public:
// `StringRef::begin()` and `StringRef::end()`. Explicitly call `update` to
// guarantee the fast path.
add(Value.size());
this->update(makeArrayRef(reinterpret_cast<const uint8_t *>(Value.begin()),
Value.size()));
this->update(ArrayRef(reinterpret_cast<const uint8_t *>(Value.begin()),
Value.size()));
return *this;
}
@ -210,7 +209,7 @@ public:
/// friend void addHash(HashBuilderImpl<HasherT, Endianness> &HBuilder,
/// const StructWithFastHash &Value) {
/// if (Endianness == support::endian::system_endianness()) {
/// HBuilder.update(makeArrayRef(
/// HBuilder.update(ArrayRef(
/// reinterpret_cast<const uint8_t *>(&Value), sizeof(Value)));
/// } else {
/// // Rely on existing `add` methods to handle endianness.
@ -240,7 +239,7 @@ public:
/// friend void addHash(HashBuilderImpl<HasherT, Endianness> &HBuilder,
/// const CustomContainer &Value) {
/// if (Endianness == support::endian::system_endianness()) {
/// HBuilder.update(makeArrayRef(
/// HBuilder.update(ArrayRef(
/// reinterpret_cast<const uint8_t *>(&Value.Size),
/// sizeof(Value.Size) + Value.Size * sizeof(Value.Elements[0])));
/// } else {
@ -320,8 +319,8 @@ public:
std::enable_if_t<is_detected<HasByteSwapT, T>::value, HashBuilderImpl &>
adjustForEndiannessAndAdd(const T &Value) {
T SwappedValue = support::endian::byte_swap(Value, Endianness);
this->update(makeArrayRef(reinterpret_cast<const uint8_t *>(&SwappedValue),
sizeof(SwappedValue)));
this->update(ArrayRef(reinterpret_cast<const uint8_t *>(&SwappedValue),
sizeof(SwappedValue)));
return *this;
}
@ -349,8 +348,8 @@ private:
Endianness == support::endian::system_endianness(),
HashBuilderImpl &>
addRangeElementsImpl(T *First, T *Last, std::forward_iterator_tag) {
this->update(makeArrayRef(reinterpret_cast<const uint8_t *>(First),
(Last - First) * sizeof(T)));
this->update(ArrayRef(reinterpret_cast<const uint8_t *>(First),
(Last - First) * sizeof(T)));
return *this;
}
};

View File

@ -353,8 +353,8 @@ public:
}
void printBinary(StringRef Label, StringRef Str, ArrayRef<char> Value) {
auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
auto V =
ArrayRef(reinterpret_cast<const uint8_t *>(Value.data()), Value.size());
printBinaryImpl(Label, Str, V, false);
}
@ -363,14 +363,14 @@ public:
}
void printBinary(StringRef Label, ArrayRef<char> Value) {
auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
auto V =
ArrayRef(reinterpret_cast<const uint8_t *>(Value.data()), Value.size());
printBinaryImpl(Label, StringRef(), V, false);
}
void printBinary(StringRef Label, StringRef Value) {
auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
auto V =
ArrayRef(reinterpret_cast<const uint8_t *>(Value.data()), Value.size());
printBinaryImpl(Label, StringRef(), V, false);
}
@ -384,8 +384,8 @@ public:
}
void printBinaryBlock(StringRef Label, StringRef Value) {
auto V = makeArrayRef(reinterpret_cast<const uint8_t *>(Value.data()),
Value.size());
auto V =
ArrayRef(reinterpret_cast<const uint8_t *>(Value.data()), Value.size());
printBinaryImpl(Label, StringRef(), V, true);
}

View File

@ -255,7 +255,7 @@ public:
void Profile(FoldingSetNodeID &ID) const;
ArrayRef<Record *> getClasses() const {
return makeArrayRef(getTrailingObjects<Record *>(), NumClasses);
return ArrayRef(getTrailingObjects<Record *>(), NumClasses);
}
using const_record_iterator = Record * const *;
@ -742,7 +742,7 @@ public:
std::string getAsString() const override;
ArrayRef<Init*> getValues() const {
return makeArrayRef(getTrailingObjects<Init *>(), NumValues);
return ArrayRef(getTrailingObjects<Init *>(), NumValues);
}
const_iterator begin() const { return getTrailingObjects<Init *>(); }
@ -1018,11 +1018,11 @@ public:
}
ArrayRef<Init *> getConds() const {
return makeArrayRef(getTrailingObjects<Init *>(), NumConds);
return ArrayRef(getTrailingObjects<Init *>(), NumConds);
}
ArrayRef<Init *> getVals() const {
return makeArrayRef(getTrailingObjects<Init *>()+NumConds, NumConds);
return ArrayRef(getTrailingObjects<Init *>() + NumConds, NumConds);
}
Init *Fold(Record *CurRec) const;
@ -1340,7 +1340,7 @@ public:
size_t args_size () const { return NumArgs; }
bool args_empty() const { return NumArgs == 0; }
ArrayRef<Init *> args() const { return makeArrayRef(args_begin(), NumArgs); }
ArrayRef<Init *> args() const { return ArrayRef(args_begin(), NumArgs); }
Init *getBit(unsigned Bit) const override {
llvm_unreachable("Illegal bit reference off anonymous def");
@ -1448,11 +1448,11 @@ public:
}
ArrayRef<Init *> getArgs() const {
return makeArrayRef(getTrailingObjects<Init *>(), NumArgs);
return ArrayRef(getTrailingObjects<Init *>(), NumArgs);
}
ArrayRef<StringInit *> getArgNames() const {
return makeArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
return ArrayRef(getTrailingObjects<StringInit *>(), NumArgNames);
}
Init *resolveReferences(Resolver &R) const override;

View File

@ -903,11 +903,10 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
return nullptr;
unsigned BitWidth = DL.getTypeSizeInBits(IntIdxTy);
APInt Offset =
APInt(BitWidth,
DL.getIndexedOffsetInType(
SrcElemTy,
makeArrayRef((Value * const *)Ops.data() + 1, Ops.size() - 1)));
APInt Offset = APInt(
BitWidth,
DL.getIndexedOffsetInType(
SrcElemTy, ArrayRef((Value *const *)Ops.data() + 1, Ops.size() - 1)));
Ptr = StripPtrCastKeepAS(Ptr);
// If this is a GEP of a GEP, fold it all into a single GEP.

View File

@ -144,7 +144,7 @@ bool ConstraintSystem::mayHaveSolution() {
bool ConstraintSystem::isConditionImplied(SmallVector<int64_t, 8> R) const {
// If all variable coefficients are 0, we have 'C >= 0'. If the constant is >=
// 0, R is always true, regardless of the system.
if (all_of(makeArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
if (all_of(ArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
return R[0] >= 0;
// If there is no solution with the negation of R added to the system, the

View File

@ -4235,7 +4235,7 @@ static Value *simplifyWithOpReplaced(Value *V, Value *Op, Value *RepOp,
if (auto *GEP = dyn_cast<GetElementPtrInst>(I))
return PreventSelfSimplify(simplifyGEPInst(
GEP->getSourceElementType(), NewOps[0], makeArrayRef(NewOps).slice(1),
GEP->getSourceElementType(), NewOps[0], ArrayRef(NewOps).slice(1),
GEP->isInBounds(), Q, MaxRecurse - 1));
if (isa<SelectInst>(I))
@ -6625,8 +6625,7 @@ static Value *simplifyInstructionWithOperands(Instruction *I,
case Instruction::GetElementPtr: {
auto *GEPI = cast<GetElementPtrInst>(I);
return simplifyGEPInst(GEPI->getSourceElementType(), NewOps[0],
makeArrayRef(NewOps).slice(1), GEPI->isInBounds(),
Q);
ArrayRef(NewOps).slice(1), GEPI->isInBounds(), Q);
}
case Instruction::InsertValue: {
InsertValueInst *IV = cast<InsertValueInst>(I);

View File

@ -673,7 +673,7 @@ bool LazyCallGraph::RefSCC::switchInternalEdgeToCall(
// Run the user's callback on the merged SCCs before we actually merge them.
if (MergeCB)
MergeCB(makeArrayRef(MergeRange.begin(), MergeRange.end()));
MergeCB(ArrayRef(MergeRange.begin(), MergeRange.end()));
// If the merge range is empty, then adding the edge didn't actually form any
// new cycles. We're done.

View File

@ -405,7 +405,7 @@ InsertPHITranslatedSubExpr(Value *InVal, BasicBlock *CurBB,
}
GetElementPtrInst *Result = GetElementPtrInst::Create(
GEP->getSourceElementType(), GEPOps[0], makeArrayRef(GEPOps).slice(1),
GEP->getSourceElementType(), GEPOps[0], ArrayRef(GEPOps).slice(1),
InVal->getName() + ".phi.trans.insert", PredBB->getTerminator());
Result->setDebugLoc(Inst->getDebugLoc());
Result->setIsInBounds(GEP->isInBounds());

View File

@ -4139,8 +4139,8 @@ static Value *BuildSubAggregate(Value *From, Value* To, Type *IndexedType,
return nullptr;
// Insert the value in the new (sub) aggregate
return InsertValueInst::Create(To, V, makeArrayRef(Idxs).slice(IdxSkip),
"tmp", InsertBefore);
return InsertValueInst::Create(To, V, ArrayRef(Idxs).slice(IdxSkip), "tmp",
InsertBefore);
}
// This helper takes a nested struct and extracts a part of it (which is again a
@ -4212,7 +4212,7 @@ Value *llvm::FindInsertedValue(Value *V, ArrayRef<unsigned> idx_range,
// %C = insertvalue {i32, i32 } %A, i32 11, 1
// which allows the unused 0,0 element from the nested struct to be
// removed.
return BuildSubAggregate(V, makeArrayRef(idx_range.begin(), req_idx),
return BuildSubAggregate(V, ArrayRef(idx_range.begin(), req_idx),
InsertBefore);
}
@ -4227,8 +4227,7 @@ Value *llvm::FindInsertedValue(Value *V, ArrayRef<unsigned> idx_range,
// requested (though possibly only partially). Now we recursively look at
// the inserted value, passing any remaining indices.
return FindInsertedValue(I->getInsertedValueOperand(),
makeArrayRef(req_idx, idx_range.end()),
InsertBefore);
ArrayRef(req_idx, idx_range.end()), InsertBefore);
}
if (ExtractValueInst *I = dyn_cast<ExtractValueInst>(V)) {

View File

@ -5795,7 +5795,7 @@ bool LLParser::convertValIDToValue(Type *Ty, ValID &ID, Value *&V,
" of struct initializer doesn't match struct element type");
V = ConstantStruct::get(
ST, makeArrayRef(ID.ConstantStructElts.get(), ID.UIntVal));
ST, ArrayRef(ID.ConstantStructElts.get(), ID.UIntVal));
} else
return error(ID.Loc, "constant expression type mismatch");
return false;

View File

@ -547,7 +547,7 @@ public:
static bool classof(const Value *V) { return V->getValueID() == SubclassID; }
ArrayRef<unsigned> getOperandIDs() const {
return makeArrayRef(getTrailingObjects<unsigned>(), NumOperands);
return ArrayRef(getTrailingObjects<unsigned>(), NumOperands);
}
std::optional<unsigned> getInRangeIndex() const {
@ -1537,9 +1537,9 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID,
C = ConstantExpr::getCompare(BC->Flags, ConstOps[0], ConstOps[1]);
break;
case Instruction::GetElementPtr:
C = ConstantExpr::getGetElementPtr(
BC->SrcElemTy, ConstOps[0], makeArrayRef(ConstOps).drop_front(),
BC->Flags, BC->getInRangeIndex());
C = ConstantExpr::getGetElementPtr(BC->SrcElemTy, ConstOps[0],
ArrayRef(ConstOps).drop_front(),
BC->Flags, BC->getInRangeIndex());
break;
case Instruction::Select:
C = ConstantExpr::getSelect(ConstOps[0], ConstOps[1], ConstOps[2]);
@ -1624,8 +1624,8 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID,
break;
case Instruction::GetElementPtr:
I = GetElementPtrInst::Create(BC->SrcElemTy, Ops[0],
makeArrayRef(Ops).drop_front(),
"constexpr", InsertBB);
ArrayRef(Ops).drop_front(), "constexpr",
InsertBB);
if (BC->Flags)
cast<GetElementPtrInst>(I)->setIsInBounds();
break;
@ -5392,7 +5392,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
unsigned ActiveWords = 1;
if (ValueBitWidth > 64)
ActiveWords = Record[CurIdx++];
Low = readWideAPInt(makeArrayRef(&Record[CurIdx], ActiveWords),
Low = readWideAPInt(ArrayRef(&Record[CurIdx], ActiveWords),
ValueBitWidth);
CurIdx += ActiveWords;
@ -5400,8 +5400,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
ActiveWords = 1;
if (ValueBitWidth > 64)
ActiveWords = Record[CurIdx++];
APInt High = readWideAPInt(
makeArrayRef(&Record[CurIdx], ActiveWords), ValueBitWidth);
APInt High = readWideAPInt(ArrayRef(&Record[CurIdx], ActiveWords),
ValueBitWidth);
CurIdx += ActiveWords;
// FIXME: It is not clear whether values in the range should be

View File

@ -1393,7 +1393,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
if (IsBigInt) {
const uint64_t BitWidth = Record[1];
const size_t NumWords = Record.size() - 3;
Value = readWideAPInt(makeArrayRef(&Record[3], NumWords), BitWidth);
Value = readWideAPInt(ArrayRef(&Record[3], NumWords), BitWidth);
} else
Value = APInt(64, unrotateSign(Record[1]), !IsUnsigned);

View File

@ -201,12 +201,12 @@ public:
/// Get the MDString metadata for this block.
ArrayRef<const Metadata *> getMDStrings() const {
return makeArrayRef(MDs).slice(NumModuleMDs, NumMDStrings);
return ArrayRef(MDs).slice(NumModuleMDs, NumMDStrings);
}
/// Get the non-MDString metadata for this block.
ArrayRef<const Metadata *> getNonMDStrings() const {
return makeArrayRef(MDs).slice(NumModuleMDs).slice(NumMDStrings);
return ArrayRef(MDs).slice(NumModuleMDs).slice(NumMDStrings);
}
const TypeList &getTypes() const { return Types; }

View File

@ -2044,7 +2044,7 @@ TypeIndex CodeViewDebug::lowerTypeFunction(const DISubroutineType *Ty) {
TypeIndex ReturnTypeIndex = TypeIndex::Void();
ArrayRef<TypeIndex> ArgTypeIndices = std::nullopt;
if (!ReturnAndArgTypeIndices.empty()) {
auto ReturnAndArgTypesRef = makeArrayRef(ReturnAndArgTypeIndices);
auto ReturnAndArgTypesRef = ArrayRef(ReturnAndArgTypeIndices);
ReturnTypeIndex = ReturnAndArgTypesRef.front();
ArgTypeIndices = ReturnAndArgTypesRef.drop_front();
}

View File

@ -42,7 +42,7 @@ static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr) {
void DIEHash::addString(StringRef Str) {
LLVM_DEBUG(dbgs() << "Adding string " << Str << " to hash.\n");
Hash.update(Str);
Hash.update(makeArrayRef((uint8_t)'\0'));
Hash.update(ArrayRef((uint8_t)'\0'));
}
// FIXME: The LEB128 routines are copied and only slightly modified out of
@ -389,7 +389,7 @@ void DIEHash::computeHash(const DIE &Die) {
}
// Following the last (or if there are no children), append a zero byte.
Hash.update(makeArrayRef((uint8_t)'\0'));
Hash.update(ArrayRef((uint8_t)'\0'));
}
/// This is based on the type signature computation given in section 7.27 of the

View File

@ -109,19 +109,18 @@ public:
ArrayRef<Entry> getEntries(const List &L) const {
size_t LI = getIndex(L);
return makeArrayRef(Entries)
.slice(Lists[LI].EntryOffset, getNumEntries(LI));
return ArrayRef(Entries).slice(Lists[LI].EntryOffset, getNumEntries(LI));
}
ArrayRef<char> getBytes(const Entry &E) const {
size_t EI = getIndex(E);
return makeArrayRef(DWARFBytes.begin(), DWARFBytes.end())
return ArrayRef(DWARFBytes.begin(), DWARFBytes.end())
.slice(Entries[EI].ByteOffset, getNumBytes(EI));
}
ArrayRef<std::string> getComments(const Entry &E) const {
size_t EI = getIndex(E);
return makeArrayRef(Comments)
.slice(Entries[EI].CommentOffset, getNumComments(EI));
return ArrayRef(Comments).slice(Entries[EI].CommentOffset,
getNumComments(EI));
}
private:

View File

@ -1664,19 +1664,19 @@ static ArrayRef<RTLIB::Libcall> GetRMWLibcall(AtomicRMWInst::BinOp Op) {
case AtomicRMWInst::BAD_BINOP:
llvm_unreachable("Should not have BAD_BINOP.");
case AtomicRMWInst::Xchg:
return makeArrayRef(LibcallsXchg);
return ArrayRef(LibcallsXchg);
case AtomicRMWInst::Add:
return makeArrayRef(LibcallsAdd);
return ArrayRef(LibcallsAdd);
case AtomicRMWInst::Sub:
return makeArrayRef(LibcallsSub);
return ArrayRef(LibcallsSub);
case AtomicRMWInst::And:
return makeArrayRef(LibcallsAnd);
return ArrayRef(LibcallsAnd);
case AtomicRMWInst::Or:
return makeArrayRef(LibcallsOr);
return ArrayRef(LibcallsOr);
case AtomicRMWInst::Xor:
return makeArrayRef(LibcallsXor);
return ArrayRef(LibcallsXor);
case AtomicRMWInst::Nand:
return makeArrayRef(LibcallsNand);
return ArrayRef(LibcallsNand);
case AtomicRMWInst::Max:
case AtomicRMWInst::Min:
case AtomicRMWInst::UMax:

View File

@ -1241,7 +1241,7 @@ simplifyRelocatesOffABase(GCRelocateInst *RelocatedBase,
}
Value *Replacement =
Builder.CreateGEP(Derived->getSourceElementType(), ActualRelocatedBase,
makeArrayRef(OffsetV));
ArrayRef(OffsetV));
Replacement->takeName(ToReplace);
// If the newly generated derived pointer's type does not match the original
// derived pointer's type, cast the new derived pointer to match it. Same
@ -5680,11 +5680,10 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
// If the final index isn't a vector, emit a scalar GEP containing all ops
// and a vector GEP with all zeroes final index.
if (!Ops[FinalIndex]->getType()->isVectorTy()) {
NewAddr =
Builder.CreateGEP(SourceTy, Ops[0], makeArrayRef(Ops).drop_front());
NewAddr = Builder.CreateGEP(SourceTy, Ops[0], ArrayRef(Ops).drop_front());
auto *IndexTy = VectorType::get(ScalarIndexTy, NumElts);
auto *SecondTy = GetElementPtrInst::getIndexedType(
SourceTy, makeArrayRef(Ops).drop_front());
SourceTy, ArrayRef(Ops).drop_front());
NewAddr =
Builder.CreateGEP(SecondTy, NewAddr, Constant::getNullValue(IndexTy));
} else {
@ -5695,10 +5694,9 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
if (Ops.size() != 2) {
// Replace the last index with 0.
Ops[FinalIndex] = Constant::getNullValue(ScalarIndexTy);
Base =
Builder.CreateGEP(SourceTy, Base, makeArrayRef(Ops).drop_front());
Base = Builder.CreateGEP(SourceTy, Base, ArrayRef(Ops).drop_front());
SourceTy = GetElementPtrInst::getIndexedType(
SourceTy, makeArrayRef(Ops).drop_front());
SourceTy, ArrayRef(Ops).drop_front());
}
// Now create the GEP with scalar pointer and vector index.

View File

@ -680,7 +680,7 @@ bool CallLowering::handleAssignments(ValueHandler &Handler,
if (VA.needsCustom()) {
std::function<void()> Thunk;
unsigned NumArgRegs = Handler.assignCustomValue(
Args[i], makeArrayRef(ArgLocs).slice(j), &Thunk);
Args[i], ArrayRef(ArgLocs).slice(j), &Thunk);
if (Thunk)
DelayedOutgoingRegAssignments.emplace_back(Thunk);
if (!NumArgRegs)

View File

@ -2367,7 +2367,7 @@ bool IRTranslator::translateCallBase(const CallBase &CB,
SwiftInVReg = MRI->createGenericVirtualRegister(Ty);
MIRBuilder.buildCopy(SwiftInVReg, SwiftError.getOrCreateVRegUseAt(
&CB, &MIRBuilder.getMBB(), Arg));
Args.emplace_back(makeArrayRef(SwiftInVReg));
Args.emplace_back(ArrayRef(SwiftInVReg));
SwiftErrorVReg =
SwiftError.getOrCreateVRegDefAt(&CB, &MIRBuilder.getMBB(), Arg);
continue;

View File

@ -5205,8 +5205,8 @@ LegalizerHelper::narrowScalarAddSub(MachineInstr &MI, unsigned TypeIdx,
CarryIn = CarryOut;
}
insertParts(MI.getOperand(0).getReg(), RegTy, NarrowTy,
makeArrayRef(DstRegs).take_front(NarrowParts), LeftoverTy,
makeArrayRef(DstRegs).drop_front(NarrowParts));
ArrayRef(DstRegs).take_front(NarrowParts), LeftoverTy,
ArrayRef(DstRegs).drop_front(NarrowParts));
MI.eraseFromParent();
return Legalized;

View File

@ -887,7 +887,7 @@ public:
ConstantInt::get(Type::getInt32Ty(LI->getContext()), 0),
ConstantInt::get(Type::getInt32Ty(LI->getContext()), i),
};
int64_t Ofs = DL.getIndexedOffsetInType(Result.VTy, makeArrayRef(Idx, 2));
int64_t Ofs = DL.getIndexedOffsetInType(Result.VTy, ArrayRef(Idx, 2));
Result.EI[i] = ElementInfo(Offset + Ofs, i == 0 ? LI : nullptr);
}

View File

@ -463,8 +463,8 @@ bool MachineCombiner::preservesResourceLen(
instr2instrSC(InsInstrs, InsInstrsSC);
instr2instrSC(DelInstrs, DelInstrsSC);
ArrayRef<const MCSchedClassDesc *> MSCInsArr = makeArrayRef(InsInstrsSC);
ArrayRef<const MCSchedClassDesc *> MSCDelArr = makeArrayRef(DelInstrsSC);
ArrayRef<const MCSchedClassDesc *> MSCInsArr{InsInstrsSC};
ArrayRef<const MCSchedClassDesc *> MSCDelArr{DelInstrsSC};
// Compute new resource length.
unsigned ResLenAfterCombine =

View File

@ -146,7 +146,7 @@ MachineTraceMetrics::getProcResourceCycles(unsigned MBBNum) const {
"getResources() must be called before getProcResourceCycles()");
unsigned PRKinds = SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceCycles.size());
return makeArrayRef(ProcResourceCycles.data() + MBBNum * PRKinds, PRKinds);
return ArrayRef(ProcResourceCycles.data() + MBBNum * PRKinds, PRKinds);
}
//===----------------------------------------------------------------------===//
@ -264,7 +264,7 @@ MachineTraceMetrics::Ensemble::
getProcResourceDepths(unsigned MBBNum) const {
unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceDepths.size());
return makeArrayRef(ProcResourceDepths.data() + MBBNum * PRKinds, PRKinds);
return ArrayRef(ProcResourceDepths.data() + MBBNum * PRKinds, PRKinds);
}
/// Get an array of processor resource heights for MBB. Indexed by processor
@ -277,7 +277,7 @@ MachineTraceMetrics::Ensemble::
getProcResourceHeights(unsigned MBBNum) const {
unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
assert((MBBNum+1) * PRKinds <= ProcResourceHeights.size());
return makeArrayRef(ProcResourceHeights.data() + MBBNum * PRKinds, PRKinds);
return ArrayRef(ProcResourceHeights.data() + MBBNum * PRKinds, PRKinds);
}
//===----------------------------------------------------------------------===//

View File

@ -681,7 +681,7 @@ bool RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
assert(T < GroupSize && "Array overflow");
TBS[T] = Number;
if (++T == GroupSize) {
SpillPlacer->addLinks(makeArrayRef(TBS, T));
SpillPlacer->addLinks(ArrayRef(TBS, T));
T = 0;
}
continue;
@ -710,13 +710,13 @@ bool RAGreedy::addThroughConstraints(InterferenceCache::Cursor Intf,
BCS[B].Exit = SpillPlacement::PrefSpill;
if (++B == GroupSize) {
SpillPlacer->addConstraints(makeArrayRef(BCS, B));
SpillPlacer->addConstraints(ArrayRef(BCS, B));
B = 0;
}
}
SpillPlacer->addConstraints(makeArrayRef(BCS, B));
SpillPlacer->addLinks(makeArrayRef(TBS, T));
SpillPlacer->addConstraints(ArrayRef(BCS, B));
SpillPlacer->addLinks(ArrayRef(TBS, T));
return true;
}
@ -757,7 +757,7 @@ bool RAGreedy::growRegion(GlobalSplitCandidate &Cand) {
// Compute through constraints from the interference, or assume that all
// through blocks prefer spilling when forming compact regions.
auto NewBlocks = makeArrayRef(ActiveBlocks).slice(AddedTo);
auto NewBlocks = ArrayRef(ActiveBlocks).slice(AddedTo);
if (Cand.PhysReg) {
if (!addThroughConstraints(Cand.Intf, NewBlocks))
return false;

View File

@ -63,7 +63,7 @@ ArrayRef<uint32_t>
PhysicalRegisterUsageInfo::getRegUsageInfo(const Function &FP) {
auto It = RegMasks.find(&FP);
if (It != RegMasks.end())
return makeArrayRef<uint32_t>(It->second);
return ArrayRef<uint32_t>(It->second);
return ArrayRef<uint32_t>();
}

View File

@ -8464,7 +8464,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
// Check if the bytes of the OR we are looking at match with either big or
// little endian value load
std::optional<bool> IsBigEndian = isBigEndian(
makeArrayRef(ByteOffsets).drop_back(ZeroExtendedBytes), FirstOffset);
ArrayRef(ByteOffsets).drop_back(ZeroExtendedBytes), FirstOffset);
if (!IsBigEndian)
return SDValue();

View File

@ -843,7 +843,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_Overflow(SDNode *N) {
SDLoc dl(N);
SDValue Res = DAG.getNode(N->getOpcode(), dl, DAG.getVTList(VT, SVT),
makeArrayRef(Ops, NumOps));
ArrayRef(Ops, NumOps));
// Modified the sum result - switch anything that used the old sum to use
// the new one.
@ -2935,13 +2935,13 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
Lo = DAG.getNode(ISD::UADDO, dl, VTList, LoOps);
HiOps[2] = Lo.getValue(1);
Hi = DAG.computeKnownBits(HiOps[2]).isZero()
? DAG.getNode(ISD::UADDO, dl, VTList, makeArrayRef(HiOps, 2))
? DAG.getNode(ISD::UADDO, dl, VTList, ArrayRef(HiOps, 2))
: DAG.getNode(ISD::ADDCARRY, dl, VTList, HiOps);
} else {
Lo = DAG.getNode(ISD::USUBO, dl, VTList, LoOps);
HiOps[2] = Lo.getValue(1);
Hi = DAG.computeKnownBits(HiOps[2]).isZero()
? DAG.getNode(ISD::USUBO, dl, VTList, makeArrayRef(HiOps, 2))
? DAG.getNode(ISD::USUBO, dl, VTList, ArrayRef(HiOps, 2))
: DAG.getNode(ISD::SUBCARRY, dl, VTList, HiOps);
}
return;
@ -2984,11 +2984,11 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
if (N->getOpcode() == ISD::ADD) {
RevOpc = ISD::SUB;
Lo = DAG.getNode(ISD::UADDO, dl, VTList, LoOps);
Hi = DAG.getNode(ISD::ADD, dl, NVT, makeArrayRef(HiOps, 2));
Hi = DAG.getNode(ISD::ADD, dl, NVT, ArrayRef(HiOps, 2));
} else {
RevOpc = ISD::ADD;
Lo = DAG.getNode(ISD::USUBO, dl, VTList, LoOps);
Hi = DAG.getNode(ISD::SUB, dl, NVT, makeArrayRef(HiOps, 2));
Hi = DAG.getNode(ISD::SUB, dl, NVT, ArrayRef(HiOps, 2));
}
SDValue OVF = Lo.getValue(1);
@ -3009,7 +3009,7 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
if (N->getOpcode() == ISD::ADD) {
Lo = DAG.getNode(ISD::ADD, dl, NVT, LoOps);
Hi = DAG.getNode(ISD::ADD, dl, NVT, makeArrayRef(HiOps, 2));
Hi = DAG.getNode(ISD::ADD, dl, NVT, ArrayRef(HiOps, 2));
SDValue Cmp = DAG.getSetCC(dl, getSetCCResultType(NVT), Lo, LoOps[0],
ISD::SETULT);
@ -3023,7 +3023,7 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
Hi = DAG.getNode(ISD::ADD, dl, NVT, Hi, Carry);
} else {
Lo = DAG.getNode(ISD::SUB, dl, NVT, LoOps);
Hi = DAG.getNode(ISD::SUB, dl, NVT, makeArrayRef(HiOps, 2));
Hi = DAG.getNode(ISD::SUB, dl, NVT, ArrayRef(HiOps, 2));
SDValue Cmp =
DAG.getSetCC(dl, getSetCCResultType(LoOps[0].getValueType()),
LoOps[0], LoOps[1], ISD::SETULT);

View File

@ -357,8 +357,7 @@ SDValue DAGTypeLegalizer::ExpandOp_BITCAST(SDNode *N) {
SmallVector<SDValue, 8> Ops;
IntegerToVector(N->getOperand(0), NumElts, Ops, NVT.getVectorElementType());
SDValue Vec =
DAG.getBuildVector(NVT, dl, makeArrayRef(Ops.data(), NumElts));
SDValue Vec = DAG.getBuildVector(NVT, dl, ArrayRef(Ops.data(), NumElts));
return DAG.getNode(ISD::BITCAST, dl, N->getValueType(0), Vec);
}

View File

@ -2649,7 +2649,7 @@ void DAGTypeLegalizer::SplitVecRes_VECTOR_SHUFFLE(ShuffleVectorSDNode *N,
// input vectors to use as shuffle operands.
unsigned FirstMaskIdx = High * NewElts;
SmallVector<int> Mask(NewElts * std::size(Inputs), UndefMaskElem);
copy(makeArrayRef(OrigMask).slice(FirstMaskIdx, NewElts), Mask.begin());
copy(ArrayRef(OrigMask).slice(FirstMaskIdx, NewElts), Mask.begin());
assert(!Output && "Expected default initialized initial value.");
TryPeekThroughShufflesInputs(Mask);
MakeUniqueInputs(Mask);
@ -4265,7 +4265,7 @@ static SDValue CollectOpsToWiden(SelectionDAG &DAG, const TargetLowering &TLI,
ConcatOps[j] = UndefVal;
}
return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT,
makeArrayRef(ConcatOps.data(), NumOps));
ArrayRef(ConcatOps.data(), NumOps));
}
SDValue DAGTypeLegalizer::WidenVecRes_BinaryCanTrap(SDNode *N) {
@ -6862,7 +6862,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
if (WidenWidth == LdTy.getSizeInBits() * (End - Idx))
return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT,
makeArrayRef(&ConcatOps[Idx], End - Idx));
ArrayRef(&ConcatOps[Idx], End - Idx));
// We need to fill the rest with undefs to build the vector.
unsigned NumOps =

View File

@ -1423,7 +1423,7 @@ DelayForLiveRegsBottomUp(SUnit *SU, SmallVectorImpl<unsigned> &LRegs) {
}
if (const uint32_t *RegMask = getNodeRegMask(Node))
CheckForLiveRegDefMasked(SU, RegMask,
makeArrayRef(LiveRegDefs.get(), TRI->getNumRegs()),
ArrayRef(LiveRegDefs.get(), TRI->getNumRegs()),
RegAdded, LRegs);
const MCInstrDesc &MCID = TII->get(Node->getMachineOpcode());

View File

@ -192,7 +192,7 @@ static void RemoveUnusedGlue(SDNode *N, SelectionDAG *DAG) {
"expected an unused glue value");
CloneNodeWithValues(N, DAG,
makeArrayRef(N->value_begin(), N->getNumValues() - 1));
ArrayRef(N->value_begin(), N->getNumValues() - 1));
}
/// ClusterNeighboringLoads - Force nearby loads together by "gluing" them.

View File

@ -4186,7 +4186,7 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
if (ChainI == MaxParallelChains) {
assert(PendingLoads.empty() && "PendingLoads must be serialized first");
SDValue Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
makeArrayRef(Chains.data(), ChainI));
ArrayRef(Chains.data(), ChainI));
Root = Chain;
ChainI = 0;
}
@ -4208,7 +4208,7 @@ void SelectionDAGBuilder::visitLoad(const LoadInst &I) {
if (!ConstantMemory) {
SDValue Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
makeArrayRef(Chains.data(), ChainI));
ArrayRef(Chains.data(), ChainI));
if (isVolatile)
DAG.setRoot(Chain);
else
@ -4329,7 +4329,7 @@ void SelectionDAGBuilder::visitStore(const StoreInst &I) {
// See visitLoad comments.
if (ChainI == MaxParallelChains) {
SDValue Chain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
makeArrayRef(Chains.data(), ChainI));
ArrayRef(Chains.data(), ChainI));
Root = Chain;
ChainI = 0;
}
@ -4345,7 +4345,7 @@ void SelectionDAGBuilder::visitStore(const StoreInst &I) {
}
SDValue StoreNode = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
makeArrayRef(Chains.data(), ChainI));
ArrayRef(Chains.data(), ChainI));
setValue(&I, StoreNode);
DAG.setRoot(StoreNode);
}
@ -9290,7 +9290,7 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
if (StructType *StructResult = dyn_cast<StructType>(CallResultType))
ResultTypes = StructResult->elements();
else if (!CallResultType->isVoidTy())
ResultTypes = makeArrayRef(CallResultType);
ResultTypes = ArrayRef(CallResultType);
auto CurResultType = ResultTypes.begin();
auto handleRegAssign = [&](SDValue V) {
@ -10804,7 +10804,7 @@ void SelectionDAGISel::LowerArguments(const Function &F) {
dyn_cast<FrameIndexSDNode>(ArgValues[0].getNode()))
FuncInfo->setArgumentFrameIndex(&Arg, FI->getIndex());
SDValue Res = DAG.getMergeValues(makeArrayRef(ArgValues.data(), NumValues),
SDValue Res = DAG.getMergeValues(ArrayRef(ArgValues.data(), NumValues),
SDB->getCurSDLoc());
SDB->setValue(&Arg, Res);

View File

@ -391,7 +391,7 @@ bool SjLjEHPrepare::setupEntryBlockAndCallSites(Function &F) {
lowerAcrossUnwindEdges(F, Invokes);
Value *FuncCtx =
setupFunctionContext(F, makeArrayRef(LPads.begin(), LPads.end()));
setupFunctionContext(F, ArrayRef(LPads.begin(), LPads.end()));
BasicBlock *EntryBB = &F.front();
IRBuilder<> Builder(EntryBB->getTerminator());

View File

@ -475,7 +475,7 @@ void VirtRegRewriter::expandCopyBundle(MachineInstr &MI) const {
// clobbering.
for (int E = MIs.size(), PrevE = E; E > 1; PrevE = E) {
for (int I = E; I--; )
if (!anyRegsAlias(MIs[I], makeArrayRef(MIs).take_front(E), TRI)) {
if (!anyRegsAlias(MIs[I], ArrayRef(MIs).take_front(E), TRI)) {
if (I + 1 != E)
std::swap(MIs[I], MIs[E - 1]);
--E;

View File

@ -68,7 +68,7 @@ uint32_t CodeViewRecordIO::maxFieldLength() const {
// the general case.
uint32_t Offset = getCurrentOffset();
std::optional<uint32_t> Min = Limits.front().bytesRemaining(Offset);
for (auto X : makeArrayRef(Limits).drop_front()) {
for (auto X : ArrayRef(Limits).drop_front()) {
std::optional<uint32_t> ThisMin = X.bytesRemaining(Offset);
if (ThisMin)
Min = Min ? std::min(*Min, *ThisMin) : *ThisMin;

View File

@ -224,7 +224,7 @@ std::vector<CVType> ContinuationRecordBuilder::end(TypeIndex Index) {
std::vector<CVType> Types;
Types.reserve(SegmentOffsets.size());
auto SO = makeArrayRef(SegmentOffsets);
ArrayRef SO = SegmentOffsets;
uint32_t End = SegmentWriter.getOffset();

View File

@ -71,7 +71,7 @@ void DebugChecksumsSubsection::addChecksum(StringRef FileName,
if (!Bytes.empty()) {
uint8_t *Copy = Storage.Allocate<uint8_t>(Bytes.size());
::memcpy(Copy, Bytes.data(), Bytes.size());
Entry.Checksum = makeArrayRef(Copy, Bytes.size());
Entry.Checksum = ArrayRef(Copy, Bytes.size());
}
Entry.FileNameOffset = Strings.insert(FileName);
@ -99,7 +99,7 @@ Error DebugChecksumsSubsection::commit(BinaryStreamWriter &Writer) const {
Header.FileNameOffset = FC.FileNameOffset;
if (auto EC = Writer.writeObject(Header))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(FC.Checksum)))
if (auto EC = Writer.writeArray(ArrayRef(FC.Checksum)))
return EC;
if (auto EC = Writer.padToAlignment(4))
return EC;

View File

@ -89,7 +89,7 @@ Error DebugCrossModuleImportsSubsection::commit(
Imp.Count = Item->getValue().size();
if (auto EC = Writer.writeObject(Imp))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(Item->getValue())))
if (auto EC = Writer.writeArray(ArrayRef(Item->getValue())))
return EC;
}
return Error::success();

View File

@ -52,7 +52,7 @@ Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const {
llvm::sort(SortedFrames, [](const FrameData &LHS, const FrameData &RHS) {
return LHS.RvaStart < RHS.RvaStart;
});
if (auto EC = Writer.writeArray(makeArrayRef(SortedFrames)))
if (auto EC = Writer.writeArray(ArrayRef(SortedFrames)))
return EC;
return Error::success();
}

View File

@ -98,7 +98,7 @@ Error DebugInlineeLinesSubsection::commit(BinaryStreamWriter &Writer) const {
if (auto EC = Writer.writeInteger<uint32_t>(E.ExtraFiles.size()))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(E.ExtraFiles)))
if (auto EC = Writer.writeArray(ArrayRef(E.ExtraFiles)))
return EC;
}

View File

@ -123,11 +123,11 @@ Error DebugLinesSubsection::commit(BinaryStreamWriter &Writer) const {
if (auto EC = Writer.writeObject(BlockHeader))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(B.Lines)))
if (auto EC = Writer.writeArray(ArrayRef(B.Lines)))
return EC;
if (hasColumnInfo()) {
if (auto EC = Writer.writeArray(makeArrayRef(B.Columns)))
if (auto EC = Writer.writeArray(ArrayRef(B.Columns)))
return EC;
}
}

View File

@ -27,7 +27,7 @@ DebugSymbolRVASubsection::DebugSymbolRVASubsection()
: DebugSubsection(DebugSubsectionKind::CoffSymbolRVA) {}
Error DebugSymbolRVASubsection::commit(BinaryStreamWriter &Writer) const {
return Writer.writeArray(makeArrayRef(RVAs));
return Writer.writeArray(ArrayRef(RVAs));
}
uint32_t DebugSymbolRVASubsection::calculateSerializedSize() const {

View File

@ -437,125 +437,125 @@ namespace llvm {
namespace codeview {
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() {
return makeArrayRef(SymbolTypeNames);
return ArrayRef(SymbolTypeNames);
}
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames() {
return makeArrayRef(TypeLeafNames);
return ArrayRef(TypeLeafNames);
}
ArrayRef<EnumEntry<uint16_t>> getRegisterNames(CPUType Cpu) {
if (Cpu == CPUType::ARMNT) {
return makeArrayRef(RegisterNames_ARM);
return ArrayRef(RegisterNames_ARM);
} else if (Cpu == CPUType::ARM64) {
return makeArrayRef(RegisterNames_ARM64);
return ArrayRef(RegisterNames_ARM64);
}
return makeArrayRef(RegisterNames_X86);
return ArrayRef(RegisterNames_X86);
}
ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() {
return makeArrayRef(PublicSymFlagNames);
return ArrayRef(PublicSymFlagNames);
}
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {
return makeArrayRef(ProcSymFlagNames);
return ArrayRef(ProcSymFlagNames);
}
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() {
return makeArrayRef(LocalFlags);
return ArrayRef(LocalFlags);
}
ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() {
return makeArrayRef(FrameCookieKinds);
return ArrayRef(FrameCookieKinds);
}
ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() {
return makeArrayRef(SourceLanguages);
return ArrayRef(SourceLanguages);
}
ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames() {
return makeArrayRef(CompileSym2FlagNames);
return ArrayRef(CompileSym2FlagNames);
}
ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames() {
return makeArrayRef(CompileSym3FlagNames);
return ArrayRef(CompileSym3FlagNames);
}
ArrayRef<EnumEntry<uint32_t>> getFileChecksumNames() {
return makeArrayRef(FileChecksumNames);
return ArrayRef(FileChecksumNames);
}
ArrayRef<EnumEntry<unsigned>> getCPUTypeNames() {
return makeArrayRef(CPUTypeNames);
return ArrayRef(CPUTypeNames);
}
ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames() {
return makeArrayRef(FrameProcSymFlagNames);
return ArrayRef(FrameProcSymFlagNames);
}
ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames() {
return makeArrayRef(ExportSymFlagNames);
return ArrayRef(ExportSymFlagNames);
}
ArrayRef<EnumEntry<uint32_t>> getModuleSubstreamKindNames() {
return makeArrayRef(ModuleSubstreamKindNames);
return ArrayRef(ModuleSubstreamKindNames);
}
ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames() {
return makeArrayRef(ThunkOrdinalNames);
return ArrayRef(ThunkOrdinalNames);
}
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames() {
return makeArrayRef(TrampolineNames);
return ArrayRef(TrampolineNames);
}
ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
getImageSectionCharacteristicNames() {
return makeArrayRef(ImageSectionCharacteristicNames);
return ArrayRef(ImageSectionCharacteristicNames);
}
ArrayRef<EnumEntry<uint16_t>> getClassOptionNames() {
return makeArrayRef(ClassOptionNames);
return ArrayRef(ClassOptionNames);
}
ArrayRef<EnumEntry<uint8_t>> getMemberAccessNames() {
return makeArrayRef(MemberAccessNames);
return ArrayRef(MemberAccessNames);
}
ArrayRef<EnumEntry<uint16_t>> getMethodOptionNames() {
return makeArrayRef(MethodOptionNames);
return ArrayRef(MethodOptionNames);
}
ArrayRef<EnumEntry<uint16_t>> getMemberKindNames() {
return makeArrayRef(MemberKindNames);
return ArrayRef(MemberKindNames);
}
ArrayRef<EnumEntry<uint8_t>> getPtrKindNames() {
return makeArrayRef(PtrKindNames);
return ArrayRef(PtrKindNames);
}
ArrayRef<EnumEntry<uint8_t>> getPtrModeNames() {
return makeArrayRef(PtrModeNames);
return ArrayRef(PtrModeNames);
}
ArrayRef<EnumEntry<uint16_t>> getPtrMemberRepNames() {
return makeArrayRef(PtrMemberRepNames);
return ArrayRef(PtrMemberRepNames);
}
ArrayRef<EnumEntry<uint16_t>> getTypeModifierNames() {
return makeArrayRef(TypeModifierNames);
return ArrayRef(TypeModifierNames);
}
ArrayRef<EnumEntry<uint8_t>> getCallingConventions() {
return makeArrayRef(CallingConventions);
return ArrayRef(CallingConventions);
}
ArrayRef<EnumEntry<uint8_t>> getFunctionOptionEnum() {
return makeArrayRef(FunctionOptionEnum);
return ArrayRef(FunctionOptionEnum);
}
ArrayRef<EnumEntry<uint16_t>> getLabelTypeEnum() {
return makeArrayRef(LabelTypeEnum);
return ArrayRef(LabelTypeEnum);
}
} // end namespace codeview

View File

@ -20,7 +20,7 @@ using namespace llvm::codeview;
using namespace llvm::codeview::detail;
GuidAdapter::GuidAdapter(StringRef Guid)
: FormatAdapter(makeArrayRef(Guid.bytes_begin(), Guid.bytes_end())) {}
: FormatAdapter(ArrayRef(Guid.bytes_begin(), Guid.bytes_end())) {}
GuidAdapter::GuidAdapter(ArrayRef<uint8_t> Guid)
: FormatAdapter(std::move(Guid)) {}

View File

@ -81,7 +81,7 @@ static inline ArrayRef<uint8_t> stabilize(BumpPtrAllocator &Alloc,
ArrayRef<uint8_t> Data) {
uint8_t *Stable = Alloc.Allocate<uint8_t>(Data.size());
memcpy(Stable, Data.data(), Data.size());
return makeArrayRef(Stable, Data.size());
return ArrayRef(Stable, Data.size());
}
TypeIndex GlobalTypeTableBuilder::insertRecordBytes(ArrayRef<uint8_t> Record) {

View File

@ -49,9 +49,8 @@ LazyRandomTypeCollection::LazyRandomTypeCollection(ArrayRef<uint8_t> Data,
LazyRandomTypeCollection::LazyRandomTypeCollection(StringRef Data,
uint32_t RecordCountHint)
: LazyRandomTypeCollection(
makeArrayRef(Data.bytes_begin(), Data.bytes_end()), RecordCountHint) {
}
: LazyRandomTypeCollection(ArrayRef(Data.bytes_begin(), Data.bytes_end()),
RecordCountHint) {}
LazyRandomTypeCollection::LazyRandomTypeCollection(const CVTypeArray &Types,
uint32_t NumRecords)

View File

@ -78,7 +78,7 @@ static inline ArrayRef<uint8_t> stabilize(BumpPtrAllocator &Alloc,
ArrayRef<uint8_t> Data) {
uint8_t *Stable = Alloc.Allocate<uint8_t>(Data.size());
memcpy(Stable, Data.data(), Data.size());
return makeArrayRef(Stable, Data.size());
return ArrayRef(Stable, Data.size());
}
TypeIndex MergingTypeTableBuilder::insertRecordAs(hash_code Hash,

View File

@ -177,7 +177,7 @@ Error TypeDumpVisitor::visitTypeBegin(CVType &Record, TypeIndex Index) {
W->getOStream() << " {\n";
W->indent();
W->printEnum("TypeLeafKind", unsigned(Record.kind()),
makeArrayRef(LeafTypeNames));
ArrayRef(LeafTypeNames));
return Error::success();
}
@ -194,8 +194,7 @@ Error TypeDumpVisitor::visitMemberBegin(CVMemberRecord &Record) {
W->startLine() << getLeafTypeName(Record.Kind);
W->getOStream() << " {\n";
W->indent();
W->printEnum("TypeLeafKind", unsigned(Record.Kind),
makeArrayRef(LeafTypeNames));
W->printEnum("TypeLeafKind", unsigned(Record.Kind), ArrayRef(LeafTypeNames));
return Error::success();
}
@ -247,7 +246,7 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, StringListRecord &Strs) {
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
uint16_t Props = static_cast<uint16_t>(Class.getOptions());
W->printNumber("MemberCount", Class.getMemberCount());
W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
W->printFlags("Properties", Props, ArrayRef(ClassOptionNames));
printTypeIndex("FieldList", Class.getFieldList());
printTypeIndex("DerivedFrom", Class.getDerivationList());
printTypeIndex("VShape", Class.getVTableShape());
@ -261,7 +260,7 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ClassRecord &Class) {
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, UnionRecord &Union) {
uint16_t Props = static_cast<uint16_t>(Union.getOptions());
W->printNumber("MemberCount", Union.getMemberCount());
W->printFlags("Properties", Props, makeArrayRef(ClassOptionNames));
W->printFlags("Properties", Props, ArrayRef(ClassOptionNames));
printTypeIndex("FieldList", Union.getFieldList());
W->printNumber("SizeOf", Union.getSize());
W->printString("Name", Union.getName());
@ -274,7 +273,7 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, EnumRecord &Enum) {
uint16_t Props = static_cast<uint16_t>(Enum.getOptions());
W->printNumber("NumEnumerators", Enum.getMemberCount());
W->printFlags("Properties", uint16_t(Enum.getOptions()),
makeArrayRef(ClassOptionNames));
ArrayRef(ClassOptionNames));
printTypeIndex("UnderlyingType", Enum.getUnderlyingType());
printTypeIndex("FieldListType", Enum.getFieldList());
W->printString("Name", Enum.getName());
@ -311,9 +310,9 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, MemberFuncIdRecord &Id) {
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ProcedureRecord &Proc) {
printTypeIndex("ReturnType", Proc.getReturnType());
W->printEnum("CallingConvention", uint8_t(Proc.getCallConv()),
makeArrayRef(CallingConventions));
ArrayRef(CallingConventions));
W->printFlags("FunctionOptions", uint8_t(Proc.getOptions()),
makeArrayRef(FunctionOptionEnum));
ArrayRef(FunctionOptionEnum));
W->printNumber("NumParameters", Proc.getParameterCount());
printTypeIndex("ArgListType", Proc.getArgumentList());
return Error::success();
@ -324,9 +323,9 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, MemberFunctionRecord &MF) {
printTypeIndex("ClassType", MF.getClassType());
printTypeIndex("ThisType", MF.getThisType());
W->printEnum("CallingConvention", uint8_t(MF.getCallConv()),
makeArrayRef(CallingConventions));
ArrayRef(CallingConventions));
W->printFlags("FunctionOptions", uint8_t(MF.getOptions()),
makeArrayRef(FunctionOptionEnum));
ArrayRef(FunctionOptionEnum));
W->printNumber("NumParameters", MF.getParameterCount());
printTypeIndex("ArgListType", MF.getArgumentList());
W->printNumber("ThisAdjustment", MF.getThisPointerAdjustment());
@ -362,8 +361,8 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, TypeServer2Record &TS) {
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
printTypeIndex("PointeeType", Ptr.getReferentType());
W->printEnum("PtrType", unsigned(Ptr.getPointerKind()),
makeArrayRef(PtrKindNames));
W->printEnum("PtrMode", unsigned(Ptr.getMode()), makeArrayRef(PtrModeNames));
ArrayRef(PtrKindNames));
W->printEnum("PtrMode", unsigned(Ptr.getMode()), ArrayRef(PtrModeNames));
W->printNumber("IsFlat", Ptr.isFlat());
W->printNumber("IsConst", Ptr.isConst());
@ -379,7 +378,7 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
printTypeIndex("ClassType", MI.getContainingType());
W->printEnum("Representation", uint16_t(MI.getRepresentation()),
makeArrayRef(PtrMemberRepNames));
ArrayRef(PtrMemberRepNames));
}
return Error::success();
@ -388,7 +387,7 @@ Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, PointerRecord &Ptr) {
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, ModifierRecord &Mod) {
uint16_t Mods = static_cast<uint16_t>(Mod.getModifiers());
printTypeIndex("ModifiedType", Mod.getModifiedType());
W->printFlags("Modifiers", Mods, makeArrayRef(TypeModifierNames));
W->printFlags("Modifiers", Mods, ArrayRef(TypeModifierNames));
return Error::success();
}
@ -441,14 +440,13 @@ void TypeDumpVisitor::printMemberAttributes(MemberAttributes Attrs) {
void TypeDumpVisitor::printMemberAttributes(MemberAccess Access,
MethodKind Kind,
MethodOptions Options) {
W->printEnum("AccessSpecifier", uint8_t(Access),
makeArrayRef(MemberAccessNames));
W->printEnum("AccessSpecifier", uint8_t(Access), ArrayRef(MemberAccessNames));
// Data members will be vanilla. Don't try to print a method kind for them.
if (Kind != MethodKind::Vanilla)
W->printEnum("MethodKind", unsigned(Kind), makeArrayRef(MemberKindNames));
W->printEnum("MethodKind", unsigned(Kind), ArrayRef(MemberKindNames));
if (Options != MethodOptions::None) {
W->printFlags("MethodOptions", unsigned(Options),
makeArrayRef(MethodOptionNames));
ArrayRef(MethodOptionNames));
}
}
@ -458,7 +456,7 @@ Error TypeDumpVisitor::visitUnknownMember(CVMemberRecord &Record) {
}
Error TypeDumpVisitor::visitUnknownType(CVType &Record) {
W->printEnum("Kind", uint16_t(Record.kind()), makeArrayRef(LeafTypeNames));
W->printEnum("Kind", uint16_t(Record.kind()), ArrayRef(LeafTypeNames));
W->printNumber("Length", uint32_t(Record.content().size()));
return Error::success();
}
@ -551,7 +549,7 @@ Error TypeDumpVisitor::visitKnownMember(CVMemberRecord &CVR,
}
Error TypeDumpVisitor::visitKnownRecord(CVType &CVR, LabelRecord &LR) {
W->printEnum("Mode", uint16_t(LR.Mode), makeArrayRef(LabelTypeEnum));
W->printEnum("Mode", uint16_t(LR.Mode), ArrayRef(LabelTypeEnum));
return Error::success();
}

View File

@ -56,7 +56,7 @@ GloballyHashedType::hashType(ArrayRef<uint8_t> RecordData,
ArrayRef<uint8_t> BytesToHash;
if (TI.isSimple() || TI.isNoneType()) {
const uint8_t *IndexBytes = reinterpret_cast<const uint8_t *>(&TI);
BytesToHash = makeArrayRef(IndexBytes, sizeof(TypeIndex));
BytesToHash = ArrayRef(IndexBytes, sizeof(TypeIndex));
} else {
if (TI.toArrayIndex() >= Prev.size() ||
Prev[TI.toArrayIndex()].empty()) {

View File

@ -122,16 +122,16 @@ static std::string getMemberAttributes(CodeViewRecordIO &IO,
if (!IO.isStreaming())
return "";
std::string AccessSpecifier = std::string(
getEnumName(IO, uint8_t(Access), makeArrayRef(getMemberAccessNames())));
getEnumName(IO, uint8_t(Access), ArrayRef(getMemberAccessNames())));
std::string MemberAttrs(AccessSpecifier);
if (Kind != MethodKind::Vanilla) {
std::string MethodKind = std::string(
getEnumName(IO, unsigned(Kind), makeArrayRef(getMemberKindNames())));
getEnumName(IO, unsigned(Kind), ArrayRef(getMemberKindNames())));
MemberAttrs += ", " + MethodKind;
}
if (Options != MethodOptions::None) {
std::string MethodOptions = getFlagNames(
IO, unsigned(Options), makeArrayRef(getMethodOptionNames()));
std::string MethodOptions =
getFlagNames(IO, unsigned(Options), ArrayRef(getMethodOptionNames()));
MemberAttrs += ", " + MethodOptions;
}
return MemberAttrs;
@ -247,7 +247,7 @@ Error TypeRecordMapping::visitTypeBegin(CVType &CVR) {
auto RecordKind = CVR.kind();
uint16_t RecordLen = CVR.length() - 2;
std::string RecordKindName = std::string(
getEnumName(IO, unsigned(RecordKind), makeArrayRef(LeafTypeNames)));
getEnumName(IO, unsigned(RecordKind), ArrayRef(LeafTypeNames)));
error(IO.mapInteger(RecordLen, "Record length"));
error(IO.mapEnum(RecordKind, "Record kind: " + RecordKindName));
}
@ -289,7 +289,7 @@ Error TypeRecordMapping::visitMemberBegin(CVMemberRecord &Record) {
std::string MemberKindName = std::string(getLeafTypeName(Record.Kind));
MemberKindName +=
" ( " +
(getEnumName(IO, unsigned(Record.Kind), makeArrayRef(LeafTypeNames)))
(getEnumName(IO, unsigned(Record.Kind), ArrayRef(LeafTypeNames)))
.str() +
" )";
error(IO.mapEnum(Record.Kind, "Member kind: " + MemberKindName));
@ -314,7 +314,7 @@ Error TypeRecordMapping::visitMemberEnd(CVMemberRecord &Record) {
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ModifierRecord &Record) {
std::string ModifierNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Modifiers),
makeArrayRef(getTypeModifierNames()));
ArrayRef(getTypeModifierNames()));
error(IO.mapInteger(Record.ModifiedType, "ModifiedType"));
error(IO.mapEnum(Record.Modifiers, "Modifiers" + ModifierNames));
return Error::success();
@ -323,10 +323,10 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ModifierRecord &Record) {
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
ProcedureRecord &Record) {
std::string CallingConvName = std::string(getEnumName(
IO, uint8_t(Record.CallConv), makeArrayRef(getCallingConventions())));
IO, uint8_t(Record.CallConv), ArrayRef(getCallingConventions())));
std::string FuncOptionNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Options),
makeArrayRef(getFunctionOptionEnum()));
ArrayRef(getFunctionOptionEnum()));
error(IO.mapInteger(Record.ReturnType, "ReturnType"));
error(IO.mapEnum(Record.CallConv, "CallingConvention: " + CallingConvName));
error(IO.mapEnum(Record.Options, "FunctionOptions" + FuncOptionNames));
@ -339,10 +339,10 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
MemberFunctionRecord &Record) {
std::string CallingConvName = std::string(getEnumName(
IO, uint8_t(Record.CallConv), makeArrayRef(getCallingConventions())));
IO, uint8_t(Record.CallConv), ArrayRef(getCallingConventions())));
std::string FuncOptionNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Options),
makeArrayRef(getFunctionOptionEnum()));
ArrayRef(getFunctionOptionEnum()));
error(IO.mapInteger(Record.ReturnType, "ReturnType"));
error(IO.mapInteger(Record.ClassType, "ClassType"));
error(IO.mapInteger(Record.ThisType, "ThisType"));
@ -382,13 +382,12 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, PointerRecord &Record) {
SmallString<128> Attr("Attrs: ");
if (IO.isStreaming()) {
std::string PtrType =
std::string(getEnumName(IO, unsigned(Record.getPointerKind()),
makeArrayRef(getPtrKindNames())));
std::string PtrType = std::string(getEnumName(
IO, unsigned(Record.getPointerKind()), ArrayRef(getPtrKindNames())));
Attr += "[ Type: " + PtrType;
std::string PtrMode = std::string(getEnumName(
IO, unsigned(Record.getMode()), makeArrayRef(getPtrModeNames())));
IO, unsigned(Record.getMode()), ArrayRef(getPtrModeNames())));
Attr += ", Mode: " + PtrMode;
auto PtrSizeOf = Record.getSize();
@ -421,7 +420,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, PointerRecord &Record) {
MemberPointerInfo &M = *Record.MemberInfo;
error(IO.mapInteger(M.ContainingType, "ClassType"));
std::string PtrMemberGetRepresentation = std::string(getEnumName(
IO, uint16_t(M.Representation), makeArrayRef(getPtrMemberRepNames())));
IO, uint16_t(M.Representation), ArrayRef(getPtrMemberRepNames())));
error(IO.mapEnum(M.Representation,
"Representation: " + PtrMemberGetRepresentation));
}
@ -445,7 +444,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ClassRecord &Record) {
std::string PropertiesNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Options),
makeArrayRef(getClassOptionNames()));
ArrayRef(getClassOptionNames()));
error(IO.mapInteger(Record.MemberCount, "MemberCount"));
error(IO.mapEnum(Record.Options, "Properties" + PropertiesNames));
error(IO.mapInteger(Record.FieldList, "FieldList"));
@ -461,7 +460,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, ClassRecord &Record) {
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, UnionRecord &Record) {
std::string PropertiesNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Options),
makeArrayRef(getClassOptionNames()));
ArrayRef(getClassOptionNames()));
error(IO.mapInteger(Record.MemberCount, "MemberCount"));
error(IO.mapEnum(Record.Options, "Properties" + PropertiesNames));
error(IO.mapInteger(Record.FieldList, "FieldList"));
@ -475,7 +474,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, UnionRecord &Record) {
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, EnumRecord &Record) {
std::string PropertiesNames =
getFlagNames(IO, static_cast<uint16_t>(Record.Options),
makeArrayRef(getClassOptionNames()));
ArrayRef(getClassOptionNames()));
error(IO.mapInteger(Record.MemberCount, "NumEnumerators"));
error(IO.mapEnum(Record.Options, "Properties" + PropertiesNames));
error(IO.mapInteger(Record.UnderlyingType, "UnderlyingType"));
@ -628,7 +627,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR,
Error TypeRecordMapping::visitKnownRecord(CVType &CVR, LabelRecord &Record) {
std::string ModeName = std::string(
getEnumName(IO, uint16_t(Record.Mode), makeArrayRef(getLabelTypeEnum())));
getEnumName(IO, uint16_t(Record.Mode), ArrayRef(getLabelTypeEnum())));
error(IO.mapEnum(Record.Mode, "Mode: " + ModeName));
return Error::success();
}

View File

@ -213,7 +213,7 @@ bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData,
bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const {
// First, check DWARF5 form classes.
if (Form < makeArrayRef(DWARF5FormClasses).size() &&
if (Form < ArrayRef(DWARF5FormClasses).size() &&
DWARF5FormClasses[Form] == FC)
return true;
// Check more forms from extensions and proposals.
@ -757,7 +757,7 @@ std::optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc) &&
Form != DW_FORM_data16)
return std::nullopt;
return makeArrayRef(Value.data, Value.uval);
return ArrayRef(Value.data, Value.uval);
}
std::optional<uint64_t> DWARFFormValue::getAsCStringOffset() const {

View File

@ -412,10 +412,10 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
uint64_t Sig = E.getSignature();
if (!E.getContributions())
continue;
for (auto E : enumerate(InfoColumnKind == DW_SECT_INFO
? makeArrayRef(E.getContributions(),
Index.getColumnKinds().size())
: makeArrayRef(E.getContribution(), 1))) {
for (auto E : enumerate(
InfoColumnKind == DW_SECT_INFO
? ArrayRef(E.getContributions(), Index.getColumnKinds().size())
: ArrayRef(E.getContribution(), 1))) {
const DWARFUnitIndex::Entry::SectionContribution &SC = E.value();
int Col = E.index();
if (SC.Length == 0)

View File

@ -301,7 +301,7 @@ Error DbiStreamBuilder::finalizeMsfLayout() {
sizeof(object::FpoData) * OldFpoData.size();
DbgStreams[(int)DbgHeaderType::FPO]->WriteFn =
[this](BinaryStreamWriter &Writer) {
return Writer.writeArray(makeArrayRef(OldFpoData));
return Writer.writeArray(ArrayRef(OldFpoData));
};
}
@ -406,7 +406,7 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
if (!SectionContribs.empty()) {
if (auto EC = Writer.writeEnum(DbiSecContribVer60))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(SectionContribs)))
if (auto EC = Writer.writeArray(ArrayRef(SectionContribs)))
return EC;
}
@ -415,7 +415,7 @@ Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
SecMapHeader SMHeader = {Size, Size};
if (auto EC = Writer.writeObject(SMHeader))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(SectionMap)))
if (auto EC = Writer.writeArray(ArrayRef(SectionMap)))
return EC;
}

View File

@ -32,7 +32,7 @@ static const EnumEntry<uint16_t> OMFSegMapDescFlagNames[] = {
namespace llvm {
namespace pdb {
ArrayRef<EnumEntry<uint16_t>> getOMFSegMapDescFlagNames() {
return makeArrayRef(OMFSegMapDescFlagNames);
return ArrayRef(OMFSegMapDescFlagNames);
}
}
}

View File

@ -117,7 +117,7 @@ static CVSymbol serializePublic(uint8_t *Mem, const BulkPublic &Pub) {
memcpy(NameMem, Pub.Name, NameLen);
// Zero the null terminator and remaining bytes.
memset(&NameMem[NameLen], 0, Size - sizeof(PublicSym32Layout) - NameLen);
return CVSymbol(makeArrayRef(reinterpret_cast<uint8_t *>(Mem), Size));
return CVSymbol(ArrayRef(reinterpret_cast<uint8_t *>(Mem), Size));
}
uint32_t GSIHashStreamBuilder::calculateSerializedLength() const {
@ -138,11 +138,11 @@ Error GSIHashStreamBuilder::commit(BinaryStreamWriter &Writer) {
if (auto EC = Writer.writeObject(Header))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(HashRecords)))
if (auto EC = Writer.writeArray(ArrayRef(HashRecords)))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(HashBitmap)))
if (auto EC = Writer.writeArray(ArrayRef(HashBitmap)))
return EC;
if (auto EC = Writer.writeArray(makeArrayRef(HashBuckets)))
if (auto EC = Writer.writeArray(ArrayRef(HashBuckets)))
return EC;
return Error::success();
}
@ -464,7 +464,7 @@ Error GSIStreamBuilder::commitPublicsHashStream(
std::vector<support::ulittle32_t> PubAddrMap = computeAddrMap(Publics);
assert(PubAddrMap.size() == Publics.size());
if (auto EC = Writer.writeArray(makeArrayRef(PubAddrMap)))
if (auto EC = Writer.writeArray(ArrayRef(PubAddrMap)))
return EC;
return Error::success();

View File

@ -251,7 +251,7 @@ void LinePrinter::formatMsfStreamData(StringRef Label, PDBFile &File,
void LinePrinter::formatMsfStreamBlocks(
PDBFile &File, const msf::MSFStreamLayout &StreamLayout) {
auto Blocks = makeArrayRef(StreamLayout.Blocks);
auto Blocks = ArrayRef(StreamLayout.Blocks);
uint64_t L = StreamLayout.Length;
while (L > 0) {

View File

@ -61,7 +61,7 @@ void TpiStreamBuilder::addTypeRecord(ArrayRef<uint8_t> Record,
"cause misalignment in the output TPI stream!");
assert(Record.size() <= codeview::MaxRecordLength);
uint16_t OneSize = (uint16_t)Record.size();
updateTypeIndexOffsets(makeArrayRef(&OneSize, 1));
updateTypeIndexOffsets(ArrayRef(&OneSize, 1));
TypeRecBuffers.push_back(Record);
// FIXME: Require it.

View File

@ -261,7 +261,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) {
// physically lay it out if it's a topmost derived class.
addChildToLayout(std::move(BL));
}
VirtualBases = makeArrayRef(AllBases).drop_front(NonVirtualBases.size());
VirtualBases = ArrayRef(AllBases).drop_front(NonVirtualBases.size());
if (Parent != nullptr)
LayoutSize = UsedBytes.find_last() + 1;

View File

@ -41,8 +41,8 @@ COFFVCRuntimeBootstrapper::loadStaticVCRuntime(JITDylib &JD,
StringRef VCLibs[] = {"libvcruntime.lib", "libcmt.lib", "libcpmt.lib"};
StringRef UCRTLibs[] = {"libucrt.lib"};
std::vector<std::string> ImportedLibraries;
if (auto Err = loadVCRuntime(JD, ImportedLibraries, makeArrayRef(VCLibs),
makeArrayRef(UCRTLibs)))
if (auto Err = loadVCRuntime(JD, ImportedLibraries, ArrayRef(VCLibs),
ArrayRef(UCRTLibs)))
return std::move(Err);
return ImportedLibraries;
}
@ -53,8 +53,8 @@ COFFVCRuntimeBootstrapper::loadDynamicVCRuntime(JITDylib &JD,
StringRef VCLibs[] = {"vcruntime.lib", "msvcrt.lib", "msvcprt.lib"};
StringRef UCRTLibs[] = {"ucrt.lib"};
std::vector<std::string> ImportedLibraries;
if (auto Err = loadVCRuntime(JD, ImportedLibraries, makeArrayRef(VCLibs),
makeArrayRef(UCRTLibs)))
if (auto Err = loadVCRuntime(JD, ImportedLibraries, ArrayRef(VCLibs),
ArrayRef(UCRTLibs)))
return std::move(Err);
return ImportedLibraries;
}

View File

@ -407,7 +407,7 @@ Error addFunctionPointerRelocationsToCurrentSymbol(jitlink::Symbol &Sym,
auto SymStartInBlock =
(const uint8_t *)B.getContent().data() + Sym.getOffset();
auto SymSize = Sym.getSize() ? Sym.getSize() : B.getSize() - Sym.getOffset();
auto Content = makeArrayRef(SymStartInBlock, SymSize);
auto Content = ArrayRef(SymStartInBlock, SymSize);
LLVM_DEBUG(dbgs() << "Adding self-relocations to " << Sym.getName() << "\n");

View File

@ -123,8 +123,8 @@ void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
// Choose an insertion point for our new instruction.
size_t IP = uniform<size_t>(IB.Rand, 0, Insts.size() - 1);
auto InstsBefore = makeArrayRef(Insts).slice(0, IP);
auto InstsAfter = makeArrayRef(Insts).slice(IP);
auto InstsBefore = ArrayRef(Insts).slice(0, IP);
auto InstsAfter = ArrayRef(Insts).slice(IP);
// Choose a source, which will be used to constrain the operation selection.
SmallVector<Value *, 2> Srcs;
@ -137,7 +137,7 @@ void InjectorIRStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
if (!OpDesc)
return;
for (const auto &Pred : makeArrayRef(OpDesc->SourcePreds).slice(1))
for (const auto &Pred : ArrayRef(OpDesc->SourcePreds).slice(1))
Srcs.push_back(IB.findOrCreateSource(BB, InstsBefore, Srcs, Pred));
if (Value *Op = OpDesc->BuilderFunc(Srcs, Insts[IP])) {
@ -358,7 +358,7 @@ void InsertCFGStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
// Choose a point where we split the block.
uint64_t IP = uniform<uint64_t>(IB.Rand, 0, Insts.size() - 1);
auto InstsBeforeSplit = makeArrayRef(Insts).slice(0, IP);
auto InstsBeforeSplit = ArrayRef(Insts).slice(0, IP);
// `Sink` inherits Blocks' terminator, `Source` will have a BranchInst
// directly jumps to `Sink`. Here, we have to create a new terminator for
@ -511,7 +511,7 @@ void SinkInstructionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
uint64_t Idx = uniform<uint64_t>(IB.Rand, 0, Insts.size() - 1);
Instruction *Inst = Insts[Idx];
// `Idx + 1` so we don't sink to ourselves.
auto InstsAfter = makeArrayRef(Insts).slice(Idx + 1);
auto InstsAfter = ArrayRef(Insts).slice(Idx + 1);
LLVMContext &C = BB.getParent()->getParent()->getContext();
// Don't sink terminators, void function calls, etc.
if (Inst->getType() != Type::getVoidTy(C))

View File

@ -174,7 +174,7 @@ OpDescriptor llvm::fuzzerop::gepDescriptor(unsigned Weight) {
Type *Ty = Srcs[0]->getType()->isOpaquePointerTy()
? Srcs[1]->getType()
: Srcs[0]->getType()->getNonOpaquePointerElementType();
auto Indices = makeArrayRef(Srcs).drop_front(2);
auto Indices = ArrayRef(Srcs).drop_front(2);
return GetElementPtrInst::Create(Ty, Srcs[0], Indices, "G", Inst);
};
// TODO: Handle aggregates and vectors

View File

@ -275,7 +275,7 @@ public:
iterator end() const { return begin() + NumAttrs; }
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, makeArrayRef(begin(), end()));
Profile(ID, ArrayRef(begin(), end()));
}
static void Profile(FoldingSetNodeID &ID, ArrayRef<Attribute> AttrList) {

View File

@ -1064,7 +1064,7 @@ AttributeListImpl::AttributeListImpl(ArrayRef<AttributeSet> Sets)
}
void AttributeListImpl::Profile(FoldingSetNodeID &ID) const {
Profile(ID, makeArrayRef(begin(), end()));
Profile(ID, ArrayRef(begin(), end()));
}
void AttributeListImpl::Profile(FoldingSetNodeID &ID,

View File

@ -1239,7 +1239,7 @@ static Value *UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder,
Idxs[l + i] = Idx + l;
}
Res = Builder.CreateShuffleVector(Res, Op, makeArrayRef(Idxs, NumElts));
Res = Builder.CreateShuffleVector(Res, Op, ArrayRef(Idxs, NumElts));
}
// Bitcast back to a 64-bit element type.
@ -1273,7 +1273,7 @@ static Value *UpgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, Value *Op,
Idxs[l + i] = Idx + l;
}
Res = Builder.CreateShuffleVector(Op, Res, makeArrayRef(Idxs, NumElts));
Res = Builder.CreateShuffleVector(Op, Res, ArrayRef(Idxs, NumElts));
}
// Bitcast back to a 64-bit element type.
@ -1293,8 +1293,8 @@ static Value *getX86MaskVec(IRBuilder<> &Builder, Value *Mask,
int Indices[4];
for (unsigned i = 0; i != NumElts; ++i)
Indices[i] = i;
Mask = Builder.CreateShuffleVector(
Mask, Mask, makeArrayRef(Indices, NumElts), "extract");
Mask = Builder.CreateShuffleVector(Mask, Mask, ArrayRef(Indices, NumElts),
"extract");
}
return Mask;
@ -1368,9 +1368,8 @@ static Value *UpgradeX86ALIGNIntrinsics(IRBuilder<> &Builder, Value *Op0,
}
}
Value *Align = Builder.CreateShuffleVector(Op1, Op0,
makeArrayRef(Indices, NumElts),
"palignr");
Value *Align = Builder.CreateShuffleVector(
Op1, Op0, ArrayRef(Indices, NumElts), "palignr");
return EmitX86Select(Builder, Mask, Align, Passthru);
}
@ -2276,14 +2275,13 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
// First extract half of each vector. This gives better codegen than
// doing it in a single shuffle.
LHS = Builder.CreateShuffleVector(LHS, LHS,
makeArrayRef(Indices, NumElts / 2));
RHS = Builder.CreateShuffleVector(RHS, RHS,
makeArrayRef(Indices, NumElts / 2));
LHS =
Builder.CreateShuffleVector(LHS, LHS, ArrayRef(Indices, NumElts / 2));
RHS =
Builder.CreateShuffleVector(RHS, RHS, ArrayRef(Indices, NumElts / 2));
// Concat the vectors.
// NOTE: Operands have to be swapped to match intrinsic definition.
Rep = Builder.CreateShuffleVector(RHS, LHS,
makeArrayRef(Indices, NumElts));
Rep = Builder.CreateShuffleVector(RHS, LHS, ArrayRef(Indices, NumElts));
Rep = Builder.CreateBitCast(Rep, CI->getType());
} else if (IsX86 && Name == "avx512.kand.w") {
Value *LHS = getX86MaskVec(Builder, CI->getArgOperand(0), 16);

View File

@ -2038,7 +2038,7 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C,
if (Idxs.empty()) return C;
Type *GEPTy = GetElementPtrInst::getGEPReturnType(
PointeeTy, C, makeArrayRef((Value *const *)Idxs.data(), Idxs.size()));
PointeeTy, C, ArrayRef((Value *const *)Idxs.data(), Idxs.size()));
if (isa<PoisonValue>(C))
return PoisonValue::get(GEPTy);

View File

@ -2995,7 +2995,7 @@ Constant *ConstantDataArray::getString(LLVMContext &Context,
StringRef Str, bool AddNull) {
if (!AddNull) {
const uint8_t *Data = Str.bytes_begin();
return get(Context, makeArrayRef(Data, Str.size()));
return get(Context, ArrayRef(Data, Str.size()));
}
SmallVector<uint8_t, 64> ElementVals;

View File

@ -1154,7 +1154,7 @@ LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
unsigned Count) {
LLVMContext &Context = *unwrap(C);
SmallVector<Metadata *, 8> MDs;
for (auto *OV : makeArrayRef(Vals, Count)) {
for (auto *OV : ArrayRef(Vals, Count)) {
Value *V = unwrap(OV);
Metadata *MD;
if (!V)
@ -1388,9 +1388,8 @@ LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
unsigned NumWords,
const uint64_t Words[]) {
IntegerType *Ty = unwrap<IntegerType>(IntTy);
return wrap(ConstantInt::get(Ty->getContext(),
APInt(Ty->getBitWidth(),
makeArrayRef(Words, NumWords))));
return wrap(ConstantInt::get(
Ty->getContext(), APInt(Ty->getBitWidth(), ArrayRef(Words, NumWords))));
}
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char Str[],
@ -1488,7 +1487,7 @@ LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
LLVMValueRef *ConstantVals,
unsigned Count, LLVMBool Packed) {
Constant **Elements = unwrap<Constant>(ConstantVals, Count);
return wrap(ConstantStruct::getAnon(*unwrap(C), makeArrayRef(Elements, Count),
return wrap(ConstantStruct::getAnon(*unwrap(C), ArrayRef(Elements, Count),
Packed != 0));
}
@ -1504,12 +1503,12 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
Constant **Elements = unwrap<Constant>(ConstantVals, Count);
StructType *Ty = unwrap<StructType>(StructTy);
return wrap(ConstantStruct::get(Ty, makeArrayRef(Elements, Count)));
return wrap(ConstantStruct::get(Ty, ArrayRef(Elements, Count)));
}
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
return wrap(ConstantVector::get(makeArrayRef(
unwrap<Constant>(ScalarConstantVals, Size), Size)));
return wrap(ConstantVector::get(
ArrayRef(unwrap<Constant>(ScalarConstantVals, Size), Size)));
}
/*-- Opcode mapping */
@ -3146,9 +3145,9 @@ LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
LLVMValueRef *Args, unsigned NumArgs,
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
const char *Name) {
return wrap(unwrap(B)->CreateInvoke(
unwrap<FunctionType>(Ty), unwrap(Fn), unwrap(Then), unwrap(Catch),
makeArrayRef(unwrap(Args), NumArgs), Name));
return wrap(unwrap(B)->CreateInvoke(unwrap<FunctionType>(Ty), unwrap(Fn),
unwrap(Then), unwrap(Catch),
ArrayRef(unwrap(Args), NumArgs), Name));
}
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
@ -3167,8 +3166,7 @@ LLVMValueRef LLVMBuildCatchPad(LLVMBuilderRef B, LLVMValueRef ParentPad,
LLVMValueRef *Args, unsigned NumArgs,
const char *Name) {
return wrap(unwrap(B)->CreateCatchPad(unwrap(ParentPad),
makeArrayRef(unwrap(Args), NumArgs),
Name));
ArrayRef(unwrap(Args), NumArgs), Name));
}
LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad,
@ -3178,9 +3176,8 @@ LLVMValueRef LLVMBuildCleanupPad(LLVMBuilderRef B, LLVMValueRef ParentPad,
Type *Ty = Type::getTokenTy(unwrap(B)->getContext());
ParentPad = wrap(Constant::getNullValue(Ty));
}
return wrap(unwrap(B)->CreateCleanupPad(unwrap(ParentPad),
makeArrayRef(unwrap(Args), NumArgs),
Name));
return wrap(unwrap(B)->CreateCleanupPad(
unwrap(ParentPad), ArrayRef(unwrap(Args), NumArgs), Name));
}
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn) {
@ -3837,7 +3834,7 @@ LLVMValueRef LLVMBuildCall2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Fn,
const char *Name) {
FunctionType *FTy = unwrap<FunctionType>(Ty);
return wrap(unwrap(B)->CreateCall(FTy, unwrap(Fn),
makeArrayRef(unwrap(Args), NumArgs), Name));
ArrayRef(unwrap(Args), NumArgs), Name));
}
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef B, LLVMValueRef If,

View File

@ -1558,8 +1558,8 @@ const DIExpression *DIExpression::extractAddressClass(const DIExpression *Expr,
if (Expr->Elements.size() == PatternSize)
return nullptr;
return DIExpression::get(Expr->getContext(),
makeArrayRef(&*Expr->Elements.begin(),
Expr->Elements.size() - PatternSize));
ArrayRef(&*Expr->Elements.begin(),
Expr->Elements.size() - PatternSize));
}
return Expr;
}

View File

@ -853,7 +853,7 @@ static ArrayRef<const char *> findTargetSubtable(StringRef Name) {
// We've either found the target or just fall back to the generic set, which
// is always first.
const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
return makeArrayRef(&IntrinsicNameTable[1] + TI.Offset, TI.Count);
return ArrayRef(&IntrinsicNameTable[1] + TI.Offset, TI.Count);
}
/// This does the actual lookup of an intrinsic ID which

View File

@ -6230,7 +6230,7 @@ void Verifier::verifyDeoptimizeCallingConvs() {
return;
const Function *First = DeoptimizeDeclarations[0];
for (const auto *F : makeArrayRef(DeoptimizeDeclarations).slice(1)) {
for (const auto *F : ArrayRef(DeoptimizeDeclarations).slice(1)) {
Check(First->getCallingConv() == F->getCallingConv(),
"All llvm.experimental.deoptimize declarations must have the same "
"calling convention",

Some files were not shown because too many files have changed in this diff Show More