Similar to how `makeArrayRef` is deprecated in favor of deduction guides, do the
same for `makeMutableArrayRef`.
Once all of the places in-tree are using the deduction guides for
`MutableArrayRef`, we can mark `makeMutableArrayRef` as deprecated.
Differential Revision: https://reviews.llvm.org/D141814
auto Close = make_scope_exit([&] { sys::fs::closeFile(*FD); });
Expected<size_t> BytesRead = sys::fs::readNativeFileSlice(
- *FD, makeMutableArrayRef(Buf, sizeof(Buf)), 0);
+ *FD, MutableArrayRef(Buf, sizeof(Buf)), 0);
if (!BytesRead) {
consumeError(BytesRead.takeError());
return false;
for (Action A : {Miss, Match})
Scores[P][W][A] = {AwfulScore, Miss};
PatTypeSet = calculateRoles(llvm::StringRef(Pat, PatN),
- llvm::makeMutableArrayRef(PatRole, PatN));
+ llvm::MutableArrayRef(PatRole, PatN));
}
std::optional<float> FuzzyMatcher::match(llvm::StringRef Word) {
// e.g. vsprintf is V S Print F, and should match [pri] but not [int].
// We could add a tokenization dictionary for common stdlib names.
WordTypeSet = calculateRoles(llvm::StringRef(Word, WordN),
- llvm::makeMutableArrayRef(WordRole, WordN));
+ llvm::MutableArrayRef(WordRole, WordN));
return true;
}
Head.range = std::move(Ranges.front());
SelectionRange *Tail = &Head;
for (auto &Range :
- llvm::makeMutableArrayRef(Ranges.data(), Ranges.size()).drop_front()) {
+ llvm::MutableArrayRef(Ranges.data(), Ranges.size()).drop_front()) {
Tail->parent = std::make_unique<SelectionRange>();
Tail = Tail->parent.get();
Tail->range = std::move(Range);
// Apply fuzzy matching text segmentation.
llvm::SmallVector<CharRole> Roles(Identifier.size());
calculateRoles(Identifier,
- llvm::makeMutableArrayRef(Roles.data(), Identifier.size()));
+ llvm::MutableArrayRef(Roles.data(), Identifier.size()));
std::string LowercaseIdentifier = Identifier.lower();
// Apply fuzzy matching text segmentation.
llvm::SmallVector<CharRole> Roles(Query.size());
- calculateRoles(Query, llvm::makeMutableArrayRef(Roles.data(), Query.size()));
+ calculateRoles(Query, llvm::MutableArrayRef(Roles.data(), Query.size()));
std::string LowercaseQuery = Query.lower();
return llvm::ArrayRef(reinterpret_cast<ForestNode *const *>(this + 1), Num);
}
llvm::MutableArrayRef<ForestNode *> children(uint16_t Num) {
- return llvm::makeMutableArrayRef(reinterpret_cast<ForestNode **>(this + 1),
- Num);
+ return llvm::MutableArrayRef(reinterpret_cast<ForestNode **>(this + 1),
+ Num);
}
Token::Index StartIndex;
MutableArrayRef<Expr *> getVars() {
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
- return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
+ return llvm::MutableArrayRef(Storage, Data->getNumChildren());
}
void setVars(ArrayRef<Expr *> VL);
MutableArrayRef<Expr *> getVars() {
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
- return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
+ return llvm::MutableArrayRef(Storage, Data->getNumChildren());
}
void setVars(ArrayRef<Expr *> VL);
MutableArrayRef<Expr *> getUDMapperRefs() {
assert(SupportsMapper &&
"Must be a clause that is possible to have user-defined mappers");
- return llvm::makeMutableArrayRef<Expr *>(
+ return llvm::MutableArrayRef<Expr *>(
static_cast<T *>(this)->template getTrailingObjects<Expr *>() +
OMPVarListClause<T>::varlist_size(),
OMPVarListClause<T>::varlist_size());
/// Get the clauses storage.
MutableArrayRef<OMPClause *> getClauses() {
- return llvm::makeMutableArrayRef(getTrailingObjects<OMPClause *>(),
+ return llvm::MutableArrayRef(getTrailingObjects<OMPClause *>(),
NumClauses);
}
ArrayRef<OMPClause *> getClauses() const {
MutableArrayRef<Expr *> getCounters() {
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind())]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the private counters storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the updates storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
2 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the updates storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
3 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the final counter updates storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
4 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the dependent counters storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
5 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the dependent inits storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
6 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
/// Get the finals conditions storage.
auto **Storage = reinterpret_cast<Expr **>(
&Data->getChildren()[getArraysOffset(getDirectiveKind()) +
7 * getLoopsNumber()]);
- return llvm::makeMutableArrayRef(Storage, getLoopsNumber());
+ return llvm::MutableArrayRef(Storage, getLoopsNumber());
}
protected:
NumReplacementTokens = NumTokens;
Token *NewReplacementTokens = PPAllocator.Allocate<Token>(NumTokens);
ReplacementTokens = NewReplacementTokens;
- return llvm::makeMutableArrayRef(NewReplacementTokens, NumTokens);
+ return llvm::MutableArrayRef(NewReplacementTokens, NumTokens);
}
void setTokens(ArrayRef<Token> Tokens, llvm::BumpPtrAllocator &PPAllocator) {
}
MutableArrayRef<Stmt *> OMPChildren::getChildren() {
- return llvm::makeMutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
+ return llvm::MutableArrayRef(getTrailingObjects<Stmt *>(), NumChildren);
}
OMPChildren *OMPChildren::Create(void *Mem, ArrayRef<OMPClause *> Clauses) {
uint8_t flag;
};
auto flags =
- makeMutableArrayRef(reinterpret_cast<RVAFlag *>(buf), syms.size());
+ MutableArrayRef(reinterpret_cast<RVAFlag *>(buf), syms.size());
for (auto t : zip(syms, flags)) {
const auto &sym = std::get<0>(t);
auto &flag = std::get<1>(t);
size_t offset = merged.recs.size();
size_t newSize = alignTo(ty.length(), 4);
merged.recs.resize(offset + newSize);
- auto newRec = makeMutableArrayRef(&merged.recs[offset], newSize);
+ auto newRec = MutableArrayRef(&merged.recs[offset], newSize);
memcpy(newRec.data(), ty.data().data(), newSize);
// Fix up the record prefix and padding bytes if it required resizing.
ArrayRef<coff_relocation> curRelocs = sc->getRelocs();
MutableArrayRef<coff_relocation> newRelocs;
if (originalRelocs.data() == curRelocs.data()) {
- newRelocs = makeMutableArrayRef(
+ newRelocs = MutableArrayRef(
bAlloc().Allocate<coff_relocation>(originalRelocs.size()),
originalRelocs.size());
} else {
- newRelocs = makeMutableArrayRef(
+ newRelocs = MutableArrayRef(
const_cast<coff_relocation *>(curRelocs.data()), curRelocs.size());
}
numSymbols - firstGlobal);
}
MutableArrayRef<Symbol *> getMutableGlobalSymbols() {
- return llvm::makeMutableArrayRef(symbols.get() + firstGlobal,
+ return llvm::MutableArrayRef(symbols.get() + firstGlobal,
numSymbols - firstGlobal);
}
SmallVector<GdbSymbol, 0> ret;
ret.reserve(numSymbols);
for (SmallVector<GdbSymbol, 0> &vec :
- makeMutableArrayRef(symbols.get(), numShards))
+ MutableArrayRef(symbols.get(), numShards))
for (GdbSymbol &sym : vec)
ret.push_back(std::move(sym));
if (error.Fail())
return error;
- auto data =
- llvm::makeMutableArrayRef(static_cast<uint8_t *>(buf), bytes_read);
+ llvm::MutableArrayRef data(static_cast<uint8_t *>(buf), bytes_read);
for (const auto &pair : m_software_breakpoints) {
lldb::addr_t bp_addr = pair.first;
auto saved_opcodes = llvm::ArrayRef(pair.second.saved_opcodes);
}
MutableArrayRef<Entry> getMutableRows() {
- return makeMutableArrayRef(Rows.get(), Header.NumBuckets);
+ return MutableArrayRef(Rows.get(), Header.NumBuckets);
}
};
unsigned getElementContainingOffset(uint64_t Offset) const;
MutableArrayRef<uint64_t> getMemberOffsets() {
- return llvm::makeMutableArrayRef(getTrailingObjects<uint64_t>(),
+ return llvm::MutableArrayRef(getTrailingObjects<uint64_t>(),
NumElements);
}
MutableArrayRef<MDOperand> operands() {
if (IsLarge)
return getLarge();
- return makeMutableArrayRef(
+ return MutableArrayRef(
reinterpret_cast<MDOperand *>(this) - SmallSize, SmallNumOps);
}
// cast away the constness from the result.
auto AR = const_cast<const InstrProfRecord *>(this)->getValueSitesForKind(
ValueKind);
- return makeMutableArrayRef(
+ return MutableArrayRef(
const_cast<InstrProfValueSiteRecord *>(AR.data()), AR.size());
}
ArrayRef<InstrProfValueSiteRecord>
// reductions are cheaper than the transformation.
ResultTy FinalResult = std::move(Results.front());
for (ResultTy &PartialResult :
- makeMutableArrayRef(Results.data() + 1, Results.size() - 1))
+ MutableArrayRef(Results.data() + 1, Results.size() - 1))
FinalResult = Reduce(FinalResult, std::move(PartialResult));
return std::move(FinalResult);
}
APFloat::roundingMode mode = roundTowardZero? APFloat::rmTowardZero
: APFloat::rmNearestTiesToEven;
APFloat::opStatus status =
- Val.convertToInteger(makeMutableArrayRef(UIntVal), ResultWidth,
+ Val.convertToInteger(MutableArrayRef(UIntVal), ResultWidth,
IsSigned, mode, &isExact);
if (status != APFloat::opOK &&
(!roundTowardZero || status != APFloat::opInexact))
APFloat apf = APFloat(APFloat::x87DoubleExtended(), GV.IntVal);
uint64_t v;
bool ignored;
- (void)apf.convertToInteger(makeMutableArrayRef(v), BitWidth,
+ (void)apf.convertToInteger(MutableArrayRef(v), BitWidth,
CE->getOpcode()==Instruction::FPToSI,
APFloat::rmTowardZero, &ignored);
GV.IntVal = v; // endian?
for (;;) {
Buffer.resize_for_overwrite(Size + ChunkSize);
Expected<size_t> ReadBytes = readNativeFile(
- FileHandle, makeMutableArrayRef(Buffer.begin() + Size, ChunkSize));
+ FileHandle, MutableArrayRef(Buffer.begin() + Size, ChunkSize));
if (!ReadBytes)
return ReadBytes.takeError();
if (*ReadBytes == 0)
} else {
bool IsHighest = 2 * i >= Accum.size();
Register SeparateOddOut[2];
- auto LocalAccum = makeMutableArrayRef(SeparateOddOut)
+ auto LocalAccum = MutableArrayRef(SeparateOddOut)
.take_front(IsHighest ? 1 : 2);
OddCarry = buildMadChain(LocalAccum, 2 * i - 1, OddCarryIn);
bool isExact = false;
// See if we can convert this to an int64_t
uint64_t UIntVal;
- if (APF.convertToInteger(makeMutableArrayRef(UIntVal), 64, true,
+ if (APF.convertToInteger(MutableArrayRef(UIntVal), 64, true,
APFloat::rmTowardZero, &isExact) != APFloat::opOK ||
!isExact)
return false;
return TEs.back();
};
(void)performExtractsShuffleAction<const TreeEntry>(
- makeMutableArrayRef(Vector.data(), Vector.size()), Base,
+ MutableArrayRef(Vector.data(), Vector.size()), Base,
[](const TreeEntry *E) { return E->getVectorFactor(); }, ResizeToVF,
EstimateShufflesCost);
InstructionCost InsertCost = TTI->getScalarizationOverhead(
Builder.SetInsertPoint(LastInsert);
auto Vector = ShuffledInserts[I].ValueMasks.takeVector();
Value *NewInst = performExtractsShuffleAction<Value>(
- makeMutableArrayRef(Vector.data(), Vector.size()),
+ MutableArrayRef(Vector.data(), Vector.size()),
FirstInsert->getOperand(0),
[](Value *Vec) {
return cast<VectorType>(Vec->getType())
return FD.takeError();
auto Close = make_scope_exit([&] { fs::closeFile(*FD); });
if (Expected<size_t> BytesRead = fs::readNativeFile(
- *FD, makeMutableArrayRef(&*Buf.begin(), Buf.size())))
+ *FD, MutableArrayRef(&*Buf.begin(), Buf.size())))
return Buf.substr(0, *BytesRead);
else
return BytesRead.takeError();
size_t ToRead) -> Expected<std::string> {
std::string Buf(ToRead, '?');
if (Expected<size_t> BytesRead = fs::readNativeFileSlice(
- *FD, makeMutableArrayRef(&*Buf.begin(), Buf.size()), Offset))
+ *FD, MutableArrayRef(&*Buf.begin(), Buf.size()), Offset))
return Buf.substr(0, *BytesRead);
else
return BytesRead.takeError();
// bytes it takes to encode a varint index to that sub-section. This allows
// for more efficiently encoding components of the same dialect (e.g. we only
// have to encode the dialect reference once).
- groupByDialectPerByte(llvm::makeMutableArrayRef(orderedAttrs));
- groupByDialectPerByte(llvm::makeMutableArrayRef(orderedOpNames));
- groupByDialectPerByte(llvm::makeMutableArrayRef(orderedTypes));
+ groupByDialectPerByte(llvm::MutableArrayRef(orderedAttrs));
+ groupByDialectPerByte(llvm::MutableArrayRef(orderedOpNames));
+ groupByDialectPerByte(llvm::MutableArrayRef(orderedTypes));
// Finalize the numbering of the dialect resources.
finalizeDialectResourceNumberings(op);
LLVM_DEBUG(llvm::dbgs() << " found coalesceable band from " << start
<< " to " << end << '\n');
- auto band =
- llvm::makeMutableArrayRef(loops.data() + start, end - start);
+ auto band = llvm::MutableArrayRef(loops.data() + start, end - start);
(void)coalesceLoops(band);
break;
}
// CHECK: for (auto [[$RET_VALUE:.*]] : [[$RET_VALUE_GROUP]])
// CHECK-NEXT: if (::mlir::failed([[$A_TYPE_CONSTRAINT]](*this, [[$RET_VALUE]].getType(), "result", index++)))
// CHECK-NEXT: return ::mlir::failure();
-// CHECK: for (auto ®ion : ::llvm::makeMutableArrayRef((*this)->getRegion(0)))
+// CHECK: for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
// CHECK-NEXT: if (::mlir::failed([[$A_REGION_CONSTRAINT]](*this, region, "d", index++)))
// CHECK-NEXT: return ::mlir::failure();
-// CHECK: for (auto *successor : ::llvm::makeMutableArrayRef(c()))
+// CHECK: for (auto *successor : ::llvm::MutableArrayRef(c()))
// CHECK-NEXT: if (::mlir::failed([[$A_SUCCESSOR_CONSTRAINT]](*this, successor, "c", index++)))
// CHECK-NEXT: return ::mlir::failure();
// CHECK: for (auto [[$RET_VALUE:.*]] : [[$RET_VALUE_GROUP]])
// CHECK-NEXT: if (::mlir::failed([[$O_TYPE_CONSTRAINT]](*this, [[$RET_VALUE]].getType(), "result", index++)))
// CHECK-NEXT: return ::mlir::failure();
-// CHECK: for (auto ®ion : ::llvm::makeMutableArrayRef((*this)->getRegion(0)))
+// CHECK: for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
// CHECK-NEXT: if (::mlir::failed([[$O_REGION_CONSTRAINT]](*this, region, "d", index++)))
// CHECK-NEXT: return ::mlir::failure();
-// CHECK: for (auto *successor : ::llvm::makeMutableArrayRef(c()))
+// CHECK: for (auto *successor : ::llvm::MutableArrayRef(c()))
// CHECK-NEXT: if (::mlir::failed([[$O_SUCCESSOR_CONSTRAINT]](*this, successor, "c", index++)))
// CHECK-NEXT: return ::mlir::failure();
///
/// {0}: The region's index.
const char *const getSingleRegion =
- "::llvm::makeMutableArrayRef((*this)->getRegion({0}))";
+ "::llvm::MutableArrayRef((*this)->getRegion({0}))";
// If we have no regions, there is nothing more to do.
const auto canSkip = [](const NamedRegion ®ion) {
/// Get a single successor.
///
/// {0}: The successor's name.
- const char *const getSingleSuccessor = "::llvm::makeMutableArrayRef({0}())";
+ const char *const getSingleSuccessor = "::llvm::MutableArrayRef({0}())";
// If we have no successors, there is nothing more to do.
const auto canSkip = [](const NamedSuccessor &successor) {