Skip to content

[clang] Use a new constructor of ArrayRef (NFC) #146007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions clang/lib/APINotes/APINotesWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,10 +1118,9 @@ void emitFunctionInfo(raw_ostream &OS, const FunctionInfo &FI) {
emitParamInfo(OS, PI);

writer.write<uint16_t>(FI.ResultType.size());
writer.write(ArrayRef<char>{FI.ResultType.data(), FI.ResultType.size()});
writer.write(ArrayRef<char>{FI.ResultType});
writer.write<uint16_t>(FI.SwiftReturnOwnership.size());
writer.write(ArrayRef<char>{FI.SwiftReturnOwnership.data(),
FI.SwiftReturnOwnership.size()});
writer.write(ArrayRef<char>{FI.SwiftReturnOwnership});
}

/// Used to serialize the on-disk global function table.
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ ASTNodeImporter::VisitCountAttributedType(const CountAttributedType *T) {

return Importer.getToContext().getCountAttributedType(
*ToWrappedTypeOrErr, CountExpr, T->isCountInBytes(), T->isOrNull(),
ArrayRef(CoupledDecls.data(), CoupledDecls.size()));
ArrayRef(CoupledDecls));
}

ExpectedType ASTNodeImporter::VisitTemplateTypeParmType(
Expand Down Expand Up @@ -6337,8 +6337,8 @@ ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(

if (GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
D2, D, Importer.getToContext(), D->getTagKind(), DC, *BeginLocOrErr,
*IdLocOrErr, ToTPList, ClassTemplate,
ArrayRef(TemplateArgs.data(), TemplateArgs.size()), CanonInjType,
*IdLocOrErr, ToTPList, ClassTemplate, ArrayRef(TemplateArgs),
CanonInjType,
cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl)))
return D2;

Expand Down
6 changes: 2 additions & 4 deletions clang/lib/Driver/OffloadBundler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,7 @@ class ObjectFileHandler final : public FileHandler {
// Input is the same as the content of the original input file, therefore
// temporary file is not needed.
if (StringRef(BundlerConfig.FilesType).starts_with("a")) {
auto InputFileOrErr =
TempFiles.Create(ArrayRef<char>(Input.data(), Input.size()));
auto InputFileOrErr = TempFiles.Create(ArrayRef<char>(Input));
if (!InputFileOrErr)
return InputFileOrErr.takeError();
ObjcopyInputFileName = *InputFileOrErr;
Expand Down Expand Up @@ -1289,8 +1288,7 @@ CompressedOffloadBundle::decompress(const llvm::MemoryBuffer &Input,
HashRecalcTimer.startTimer();
llvm::MD5 Hash;
llvm::MD5::MD5Result Result;
Hash.update(llvm::ArrayRef<uint8_t>(DecompressedData.data(),
DecompressedData.size()));
Hash.update(llvm::ArrayRef<uint8_t>(DecompressedData));
Hash.final(Result);
uint64_t RecalculatedHash = Result.low();
HashRecalcTimer.stopTimer();
Expand Down
5 changes: 2 additions & 3 deletions clang/lib/Sema/SemaDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16427,9 +16427,8 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl *Constructor,

DiagnoseSentinelCalls(Constructor, Loc, AllArgs);

CheckConstructorCall(Constructor, DeclInitType,
llvm::ArrayRef(AllArgs.data(), AllArgs.size()), Proto,
Loc);
CheckConstructorCall(Constructor, DeclInitType, llvm::ArrayRef(AllArgs),
Proto, Loc);

return Invalid;
}
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,9 +1773,9 @@ Sema::ActOnTemplateParameterList(unsigned Depth,
for (NamedDecl *P : Params)
warnOnReservedIdentifier(P);

return TemplateParameterList::Create(
Context, TemplateLoc, LAngleLoc,
llvm::ArrayRef(Params.data(), Params.size()), RAngleLoc, RequiresClause);
return TemplateParameterList::Create(Context, TemplateLoc, LAngleLoc,
llvm::ArrayRef(Params), RAngleLoc,
RequiresClause);
}

static void SetNestedNameSpecifier(Sema &S, TagDecl *T,
Expand Down