Skip to content

[clang] llvm::append_range (NFC) #136440

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
2 changes: 1 addition & 1 deletion clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3739,7 +3739,7 @@ class Parser : public CodeCompletionHandler {
SmallVector<Expr *> getAllExprs() {
SmallVector<Expr *> Out;
Out.push_back(DevNumExpr);
Out.insert(Out.end(), QueueIdExprs.begin(), QueueIdExprs.end());
llvm::append_range(Out, QueueIdExprs);
return Out;
}
};
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ void DeclContext::localUncachedLookup(DeclarationName Name,
// the results.
if (!hasExternalVisibleStorage() && !hasExternalLexicalStorage() && Name) {
lookup_result LookupResults = lookup(Name);
Results.insert(Results.end(), LookupResults.begin(), LookupResults.end());
llvm::append_range(Results, LookupResults);
if (!Results.empty())
return;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/Randstruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void randomizeStructureLayoutImpl(const ASTContext &Context,
if (!B->isBitfieldRun())
std::shuffle(std::begin(RandFields), std::end(RandFields), RNG);

FinalOrder.insert(FinalOrder.end(), RandFields.begin(), RandFields.end());
llvm::append_range(FinalOrder, RandFields);
}

FieldsOut = FinalOrder;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Analysis/FlowSensitive/CNFFormula.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void CNFFormula::addClause(ArrayRef<Literal> lits) {

const size_t S = Clauses.size();
ClauseStarts.push_back(S);
Clauses.insert(Clauses.end(), lits.begin(), lits.end());
llvm::append_range(Clauses, lits);
}

CNFFormula buildCNF(const llvm::ArrayRef<const Formula *> &Formulas,
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Basic/Targets/RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ static void populateNegativeRISCVFeatures(std::vector<std::string> &Features) {

std::vector<std::string> FeatStrings =
(*RII)->toFeatures(/* AddAllExtensions */ true);
Features.insert(Features.end(), FeatStrings.begin(), FeatStrings.end());
llvm::append_range(Features, FeatStrings);
}

static void handleFullArchString(StringRef FullArchStr,
Expand All @@ -454,7 +454,7 @@ static void handleFullArchString(StringRef FullArchStr,
populateNegativeRISCVFeatures(Features);
std::vector<std::string> FeatStrings =
(*RII)->toFeatures(/* AddAllExtensions */ true);
Features.insert(Features.end(), FeatStrings.begin(), FeatStrings.end());
llvm::append_range(Features, FeatStrings);
}
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGObjCMac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7120,7 +7120,7 @@ RValue CGObjCNonFragileABIMac::EmitVTableMessageSend(
// the actual argument value blank for now.
args.add(RValue::get(nullptr), ObjCTypes.MessageRefCPtrTy);

args.insert(args.end(), formalArgs.begin(), formalArgs.end());
llvm::append_range(args, formalArgs);

MessageSendInfo MSI = getMessageSendInfo(method, resultType, args);

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ IncrementalCompilerBuilder::CreateCpp() {
Argv.push_back("wasm32-unknown-emscripten");
Argv.push_back("-fvisibility=default");
#endif
Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());
llvm::append_range(Argv, UserArgs);

std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
return IncrementalCompilerBuilder::create(TT, Argv);
Expand Down Expand Up @@ -232,7 +232,7 @@ IncrementalCompilerBuilder::createCuda(bool device) {
Argv.push_back(ArchArg.c_str());
}

Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());
llvm::append_range(Argv, UserArgs);

std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
return IncrementalCompilerBuilder::create(TT, Argv);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ unsigned Parser::ParseAttributeArgsCommon(
}
}

ArgExprs.insert(ArgExprs.end(), ParsedExprs.begin(), ParsedExprs.end());
llvm::append_range(ArgExprs, ParsedExprs);
}
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseStmtAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
});

// Build the vector of clobber StringRefs.
ClobberRefs.insert(ClobberRefs.end(), Clobbers.begin(), Clobbers.end());
llvm::append_range(ClobberRefs, Clobbers);

// Recast the void pointers and build the vector of constraint StringRefs.
unsigned NumExprs = NumOutputs + NumInputs;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ struct BuiltinDumpStructGenerator {
Args.reserve((TheCall->getNumArgs() - 2) + /*Format*/ 1 + Exprs.size());
Args.assign(TheCall->arg_begin() + 2, TheCall->arg_end());
Args.push_back(getStringLiteral(Format));
Args.insert(Args.end(), Exprs.begin(), Exprs.end());
llvm::append_range(Args, Exprs);

// Register a note to explain why we're performing the call.
Sema::CodeSynthesisContext Ctx;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2532,7 +2532,7 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
: &OpaqueAllocationSize);
if (isAlignedAllocation(IAP.PassAlignment))
CallArgs.emplace_back(&DesiredAlignment);
CallArgs.insert(CallArgs.end(), PlacementArgs.begin(), PlacementArgs.end());
llvm::append_range(CallArgs, PlacementArgs);

DiagnoseSentinelCalls(OperatorNew, PlacementLParen, CallArgs);

Expand Down Expand Up @@ -2969,7 +2969,7 @@ bool Sema::FindAllocationFunctions(
if (IncludeAlignParam)
AllocArgs.push_back(&Align);

AllocArgs.insert(AllocArgs.end(), PlaceArgs.begin(), PlaceArgs.end());
llvm::append_range(AllocArgs, PlaceArgs);

// Find the allocation function.
{
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/Sema/SemaHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2749,7 +2749,7 @@ static void BuildFlattenedTypeList(QualType BaseTy,
BuildFlattenedTypeList(AT->getElementType(), ElementFields);
// Repeat the element's field list n times.
for (uint64_t Ct = 0; Ct < AT->getZExtSize(); ++Ct)
List.insert(List.end(), ElementFields.begin(), ElementFields.end());
llvm::append_range(List, ElementFields);
continue;
}
// Vectors can only have element types that are builtin types, so this can
Expand Down Expand Up @@ -2777,7 +2777,7 @@ static void BuildFlattenedTypeList(QualType BaseTy,
FieldTypes.push_back(FD->getType());
// Reverse the newly added sub-range.
std::reverse(FieldTypes.begin(), FieldTypes.end());
WorkList.insert(WorkList.end(), FieldTypes.begin(), FieldTypes.end());
llvm::append_range(WorkList, FieldTypes);

// If this wasn't a standard layout type we may also have some base
// classes to deal with.
Expand All @@ -2786,7 +2786,7 @@ static void BuildFlattenedTypeList(QualType BaseTy,
for (const auto &Base : RD->bases())
FieldTypes.push_back(Base.getType());
std::reverse(FieldTypes.begin(), FieldTypes.end());
WorkList.insert(WorkList.end(), FieldTypes.begin(), FieldTypes.end());
llvm::append_range(WorkList, FieldTypes);
}
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5611,7 +5611,7 @@ void Sema::diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl,
llvm::SmallVector<Module*, 8> OwningModules;
OwningModules.push_back(Owner);
auto Merged = Context.getModulesWithMergedDefinition(Def);
OwningModules.insert(OwningModules.end(), Merged.begin(), Merged.end());
llvm::append_range(OwningModules, Merged);

diagnoseMissingImport(Loc, Def, Def->getLocation(), OwningModules, MIK,
Recover);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/TreeTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -4205,7 +4205,7 @@ class TreeTransform {
ArrayRef<OpenACCClause *> Clauses) {
llvm::SmallVector<Expr *> Exprs;
Exprs.push_back(DevNumExpr);
Exprs.insert(Exprs.end(), QueueIdExprs.begin(), QueueIdExprs.end());
llvm::append_range(Exprs, QueueIdExprs);
return getSema().OpenACC().ActOnEndStmtDirective(
OpenACCDirectiveKind::Wait, BeginLoc, DirLoc, LParenLoc, QueuesLoc,
Exprs, OpenACCAtomicKind::None, RParenLoc, EndLoc, Clauses, {});
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5242,13 +5242,13 @@ void ASTWriter::AddToken(const Token &Tok, RecordDataImpl &Record) {

void ASTWriter::AddString(StringRef Str, RecordDataImpl &Record) {
Record.push_back(Str.size());
Record.insert(Record.end(), Str.begin(), Str.end());
llvm::append_range(Record, Str);
}

void ASTWriter::AddStringBlob(StringRef Str, RecordDataImpl &Record,
SmallVectorImpl<char> &Blob) {
Record.push_back(Str.size());
Blob.insert(Blob.end(), Str.begin(), Str.end());
llvm::append_range(Blob, Str);
}

bool ASTWriter::PreparePathForOutput(SmallVectorImpl<char> &Path) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/BugReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,7 @@ static void CompactMacroExpandedPieces(PathPieces &path,
// Now take the pieces and construct a new PathDiagnostic.
path.clear();

path.insert(path.end(), Pieces.begin(), Pieces.end());
llvm::append_range(path, Pieces);
}

/// Generate notes from all visitors.
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/RegionStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,7 @@ RegionStoreManager::getInterestingValues(nonloc::LazyCompoundVal LCV) {

if (auto InnerLCV = V.getAs<nonloc::LazyCompoundVal>()) {
const SValListTy &InnerList = getInterestingValues(*InnerLCV);
List.insert(List.end(), InnerList.begin(), InnerList.end());
llvm::append_range(List, InnerList);
}

List.push_back(V);
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Tooling/Tooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ getSyntaxOnlyToolArgs(const Twine &ToolName,
std::vector<std::string> Args;
Args.push_back(ToolName.str());
Args.push_back("-fsyntax-only");
Args.insert(Args.end(), ExtraArgs.begin(), ExtraArgs.end());
llvm::append_range(Args, ExtraArgs);
Args.push_back(FileName.str());
return Args;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static std::unique_ptr<Interpreter>
createInterpreter(const Args &ExtraArgs = {},
DiagnosticConsumer *Client = nullptr) {
Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
llvm::append_range(ClangArgs, ExtraArgs);
auto CB = clang::IncrementalCompilerBuilder();
CB.SetCompilerArgs(ClangArgs);
auto CI = cantFail(CB.CreateCpp());
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/Interpreter/InterpreterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static std::unique_ptr<Interpreter>
createInterpreter(const Args &ExtraArgs = {},
DiagnosticConsumer *Client = nullptr) {
Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
llvm::append_range(ClangArgs, ExtraArgs);
auto CB = clang::IncrementalCompilerBuilder();
CB.SetCompilerArgs(ClangArgs);
auto CI = cantFail(CB.CreateCpp());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TestFileCollector : public DependencyFileGenerator {

void finishedMainFile(DiagnosticsEngine &Diags) override {
auto NewDeps = getDependencies();
Deps.insert(Deps.end(), NewDeps.begin(), NewDeps.end());
llvm::append_range(Deps, NewDeps);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion clang/utils/TableGen/ClangAttrEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4560,7 +4560,7 @@ static void GenerateTargetRequirements(const Record &Attr,
std::vector<StringRef> DA =
I.second->getValueAsDef("Target")->getValueAsListOfStrings(
"Arches");
Arches.insert(Arches.end(), DA.begin(), DA.end());
llvm::append_range(Arches, DA);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion clang/utils/TableGen/MveEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class IRIntrinsicResult : public Result {
OS << "})";
}
void morePrerequisites(std::vector<Ptr> &output) const override {
output.insert(output.end(), Args.begin(), Args.end());
llvm::append_range(output, Args);
}
};

Expand Down
Loading