llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-analysis @llvm/pr-subscribers-clang-format Author: Kazu Hirata (kazutakahirata) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/136448.diff 18 Files Affected: - (modified) clang/lib/AST/ByteCode/State.cpp (+2-4) - (modified) clang/lib/AST/ExprConstant.cpp (+2-4) - (modified) clang/lib/AST/ItaniumMangle.cpp (+6-12) - (modified) clang/lib/AST/Randstruct.cpp (+2-4) - (modified) clang/lib/Analysis/IntervalPartition.cpp (+1-1) - (modified) clang/lib/CodeGen/CGCall.h (+3-6) - (modified) clang/lib/CodeGen/CGLoopInfo.cpp (+1-2) - (modified) clang/lib/Driver/MultilibBuilder.cpp (+3-4) - (modified) clang/lib/Driver/ToolChains/HIPUtility.cpp (+1-2) - (modified) clang/lib/Format/SortJavaScriptImports.cpp (+1-2) - (modified) clang/lib/Frontend/CompilerInstance.cpp (+1-2) - (modified) clang/lib/Frontend/CompilerInvocation.cpp (+1-1) - (modified) clang/lib/Sema/ParsedAttr.cpp (+2-2) - (modified) clang/lib/Sema/SemaConcept.cpp (+1-2) - (modified) clang/lib/Serialization/MultiOnDiskHashTable.h (+1-2) - (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+1-2) - (modified) clang/tools/clang-installapi/Options.cpp (+1-2) - (modified) clang/unittests/Format/MacroCallReconstructorTest.cpp (+1-2) ``````````diff diff --git a/clang/lib/AST/ByteCode/State.cpp b/clang/lib/AST/ByteCode/State.cpp index b4db86e8d22c7..3204d1a193a74 100644 --- a/clang/lib/AST/ByteCode/State.cpp +++ b/clang/lib/AST/ByteCode/State.cpp @@ -67,10 +67,8 @@ OptionalDiagnostic State::Note(SourceLocation Loc, diag::kind DiagId) { } void State::addNotes(ArrayRef<PartialDiagnosticAt> Diags) { - if (hasActiveDiagnostic()) { - getEvalStatus().Diag->insert(getEvalStatus().Diag->end(), Diags.begin(), - Diags.end()); - } + if (hasActiveDiagnostic()) + llvm::append_range(*getEvalStatus().Diag, Diags); } DiagnosticBuilder State::report(SourceLocation Loc, diag::kind DiagId) { diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index b14ff21a8ebc2..f598ef5929aa4 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -298,8 +298,7 @@ namespace { assert(V.isLValue() && "Non-LValue used to make an LValue designator?"); if (!Invalid) { IsOnePastTheEnd = V.isLValueOnePastTheEnd(); - ArrayRef<PathEntry> VEntries = V.getLValuePath(); - Entries.insert(Entries.end(), VEntries.begin(), VEntries.end()); + llvm::append_range(Entries, V.getLValuePath()); if (V.getLValueBase()) { bool IsArray = false; bool FirstIsUnsizedArray = false; @@ -1832,8 +1831,7 @@ namespace { DeclAndIsDerivedMember.setPointer(V.getMemberPointerDecl()); DeclAndIsDerivedMember.setInt(V.isMemberPointerToDerivedMember()); Path.clear(); - ArrayRef<const CXXRecordDecl*> P = V.getMemberPointerPath(); - Path.insert(Path.end(), P.begin(), P.end()); + llvm::append_range(Path, V.getMemberPointerPath()); } /// DeclAndIsDerivedMember - The member declaration, and a flag indicating diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 977caa8e55db3..97ef1c0d46960 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -309,10 +309,8 @@ class CXXNameMangler { !AdditionalAbiTags && "only function and variables need a list of additional abi tags"); if (const auto *NS = dyn_cast<NamespaceDecl>(ND)) { - if (const auto *AbiTag = NS->getAttr<AbiTagAttr>()) { - UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(), - AbiTag->tags().end()); - } + if (const auto *AbiTag = NS->getAttr<AbiTagAttr>()) + llvm::append_range(UsedAbiTags, AbiTag->tags()); // Don't emit abi tags for namespaces. return; } @@ -320,17 +318,13 @@ class CXXNameMangler { AbiTagList TagList; if (const auto *AbiTag = ND->getAttr<AbiTagAttr>()) { - UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(), - AbiTag->tags().end()); - TagList.insert(TagList.end(), AbiTag->tags().begin(), - AbiTag->tags().end()); + llvm::append_range(UsedAbiTags, AbiTag->tags()); + llvm::append_range(TagList, AbiTag->tags()); } if (AdditionalAbiTags) { - UsedAbiTags.insert(UsedAbiTags.end(), AdditionalAbiTags->begin(), - AdditionalAbiTags->end()); - TagList.insert(TagList.end(), AdditionalAbiTags->begin(), - AdditionalAbiTags->end()); + llvm::append_range(UsedAbiTags, *AdditionalAbiTags); + llvm::append_range(TagList, *AdditionalAbiTags); } llvm::sort(TagList); diff --git a/clang/lib/AST/Randstruct.cpp b/clang/lib/AST/Randstruct.cpp index 5cba2f0a3c154..c1bd76a2d0962 100644 --- a/clang/lib/AST/Randstruct.cpp +++ b/clang/lib/AST/Randstruct.cpp @@ -208,12 +208,10 @@ bool randomizeStructureLayout(const ASTContext &Context, RecordDecl *RD, randomizeStructureLayoutImpl(Context, RandomizedFields, RNG); // Plorp the randomized decls into the final ordering. - FinalOrdering.insert(FinalOrdering.end(), RandomizedFields.begin(), - RandomizedFields.end()); + llvm::append_range(FinalOrdering, RandomizedFields); // Add fields that belong towards the end of the RecordDecl. - FinalOrdering.insert(FinalOrdering.end(), PostRandomizedFields.begin(), - PostRandomizedFields.end()); + llvm::append_range(FinalOrdering, PostRandomizedFields); // Add back the flexible array. if (FlexibleArray) diff --git a/clang/lib/Analysis/IntervalPartition.cpp b/clang/lib/Analysis/IntervalPartition.cpp index 41199f358c5b9..0733239925747 100644 --- a/clang/lib/Analysis/IntervalPartition.cpp +++ b/clang/lib/Analysis/IntervalPartition.cpp @@ -132,7 +132,7 @@ static void fillIntervalNode(CFGIntervalGraph &Graph, Count += N->Nodes.size(); Nodes.reserve(Count); for (auto &N : Result.Nodes) - Nodes.insert(Nodes.end(), N->Nodes.begin(), N->Nodes.end()); + llvm::append_range(Nodes, N->Nodes); Interval.Nodes = std::move(Nodes); } } diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h index 92e0cc43919ca..0b4e3f9cb0365 100644 --- a/clang/lib/CodeGen/CGCall.h +++ b/clang/lib/CodeGen/CGCall.h @@ -312,12 +312,9 @@ class CallArgList : public SmallVector<CallArg, 8> { /// this, the old CallArgList retains its list of arguments, but must not /// be used to emit a call. void addFrom(const CallArgList &other) { - insert(end(), other.begin(), other.end()); - Writebacks.insert(Writebacks.end(), other.Writebacks.begin(), - other.Writebacks.end()); - CleanupsToDeactivate.insert(CleanupsToDeactivate.end(), - other.CleanupsToDeactivate.begin(), - other.CleanupsToDeactivate.end()); + llvm::append_range(*this, other); + llvm::append_range(Writebacks, other.Writebacks); + llvm::append_range(CleanupsToDeactivate, other.CleanupsToDeactivate); assert(!(StackBase && other.StackBase) && "can't merge stackbases"); if (!StackBase) StackBase = other.StackBase; diff --git a/clang/lib/CodeGen/CGLoopInfo.cpp b/clang/lib/CodeGen/CGLoopInfo.cpp index 2b7d7881ab990..4a9092842858b 100644 --- a/clang/lib/CodeGen/CGLoopInfo.cpp +++ b/clang/lib/CodeGen/CGLoopInfo.cpp @@ -424,8 +424,7 @@ SmallVector<Metadata *, 4> LoopInfo::createMetadata( LoopProperties.push_back(MDNode::get(Ctx, Vals)); } - LoopProperties.insert(LoopProperties.end(), AdditionalLoopProperties.begin(), - AdditionalLoopProperties.end()); + llvm::append_range(LoopProperties, AdditionalLoopProperties); return createFullUnrollMetadata(Attrs, LoopProperties, HasUserTransforms); } diff --git a/clang/lib/Driver/MultilibBuilder.cpp b/clang/lib/Driver/MultilibBuilder.cpp index 4fbe9d9047bde..8440a82f78bef 100644 --- a/clang/lib/Driver/MultilibBuilder.cpp +++ b/clang/lib/Driver/MultilibBuilder.cpp @@ -142,8 +142,8 @@ static MultilibBuilder compose(const MultilibBuilder &Base, MultilibBuilder::flags_list &Flags = Composed.flags(); - Flags.insert(Flags.end(), Base.flags().begin(), Base.flags().end()); - Flags.insert(Flags.end(), New.flags().begin(), New.flags().end()); + llvm::append_range(Flags, Base.flags()); + llvm::append_range(Flags, New.flags()); return Composed; } @@ -153,8 +153,7 @@ MultilibSetBuilder::Either(ArrayRef<MultilibBuilder> MultilibSegments) { multilib_list Composed; if (Multilibs.empty()) - Multilibs.insert(Multilibs.end(), MultilibSegments.begin(), - MultilibSegments.end()); + llvm::append_range(Multilibs, MultilibSegments); else { for (const auto &New : MultilibSegments) { for (const auto &Base : Multilibs) { diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp index b4469c05cea3f..1fc9118419684 100644 --- a/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -190,8 +190,7 @@ class HIPUndefinedFatBinSymbols { processInput(BufferOrErr.get()->getMemBufferRef()); } else - WorkList.insert(WorkList.end(), CurrentAction->getInputs().begin(), - CurrentAction->getInputs().end()); + llvm::append_range(WorkList, CurrentAction->getInputs()); } } diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp index 1acce26ff2795..f55993fb4c11c 100644 --- a/clang/lib/Format/SortJavaScriptImports.cpp +++ b/clang/lib/Format/SortJavaScriptImports.cpp @@ -276,8 +276,7 @@ class JavaScriptImportSorter : public TokenAnalyzer { } stable_sort(SortChunk); mergeModuleReferences(SortChunk); - ReferencesSorted.insert(ReferencesSorted.end(), SortChunk.begin(), - SortChunk.end()); + llvm::append_range(ReferencesSorted, SortChunk); } return ReferencesSorted; } diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 93e4e31c2891d..533cef35e776b 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -598,8 +598,7 @@ struct ReadModuleNames : ASTReaderListener { if (Current->IsUnimportable) continue; Current->IsAvailable = true; auto SubmodulesRange = Current->submodules(); - Stack.insert(Stack.end(), SubmodulesRange.begin(), - SubmodulesRange.end()); + llvm::append_range(Stack, SubmodulesRange); } } } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index cfc5c069b0849..9e9eed4efc577 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2078,7 +2078,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, A->render(Args, ASL); for (const auto &arg : ASL) { StringRef ArgStr(arg); - Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end()); + llvm::append_range(Opts.CmdArgs, ArgStr); // using \00 to separate each commandline options. Opts.CmdArgs.push_back('\0'); } diff --git a/clang/lib/Sema/ParsedAttr.cpp b/clang/lib/Sema/ParsedAttr.cpp index c149cef478539..ba12a5aae5773 100644 --- a/clang/lib/Sema/ParsedAttr.cpp +++ b/clang/lib/Sema/ParsedAttr.cpp @@ -86,14 +86,14 @@ void AttributeFactory::reclaimPool(AttributePool &cur) { } void AttributePool::takePool(AttributePool &pool) { - Attrs.insert(Attrs.end(), pool.Attrs.begin(), pool.Attrs.end()); + llvm::append_range(Attrs, pool.Attrs); pool.Attrs.clear(); } void AttributePool::takeFrom(ParsedAttributesView &List, AttributePool &Pool) { assert(&Pool != this && "AttributePool can't take attributes from itself"); llvm::for_each(List.AttrList, [&Pool](ParsedAttr *A) { Pool.remove(A); }); - Attrs.insert(Attrs.end(), List.AttrList.begin(), List.AttrList.end()); + llvm::append_range(Attrs, List.AttrList); } namespace { diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index 5424d207d3c77..15b9c97489e7f 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -639,8 +639,7 @@ bool Sema::CheckConstraintSatisfaction( // here. llvm::SmallVector<TemplateArgument, 4> FlattenedArgs; for (auto List : TemplateArgsLists) - FlattenedArgs.insert(FlattenedArgs.end(), List.Args.begin(), - List.Args.end()); + llvm::append_range(FlattenedArgs, List.Args); llvm::FoldingSetNodeID ID; ConstraintSatisfaction::Profile(ID, Context, Template, FlattenedArgs); diff --git a/clang/lib/Serialization/MultiOnDiskHashTable.h b/clang/lib/Serialization/MultiOnDiskHashTable.h index 996e9b94287f4..a179016d47419 100644 --- a/clang/lib/Serialization/MultiOnDiskHashTable.h +++ b/clang/lib/Serialization/MultiOnDiskHashTable.h @@ -209,8 +209,7 @@ template<typename Info> class MultiOnDiskHashTable { OverriddenFiles.reserve(NumFiles); for (/**/; NumFiles != 0; --NumFiles) OverriddenFiles.push_back(InfoObj.ReadFileRef(Ptr)); - PendingOverrides.insert(PendingOverrides.end(), OverriddenFiles.begin(), - OverriddenFiles.end()); + llvm::append_range(PendingOverrides, OverriddenFiles); // Read the OnDiskChainedHashTable header. storage_type Buckets = Data + BucketOffset; diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp index bae436afe0897..b88a7cb2dca21 100644 --- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp @@ -752,8 +752,7 @@ bool DependencyScanningWorker::scanDependencies( // Insert -cc1 comand line options into Argv std::vector<std::string> Argv; Argv.push_back(Cmd.getExecutable()); - Argv.insert(Argv.end(), Cmd.getArguments().begin(), - Cmd.getArguments().end()); + llvm::append_range(Argv, Cmd.getArguments()); // Create an invocation that uses the underlying file // system to ensure that any file system requests that diff --git a/clang/tools/clang-installapi/Options.cpp b/clang/tools/clang-installapi/Options.cpp index efb36848dbbf1..9bc168c8cd4f8 100644 --- a/clang/tools/clang-installapi/Options.cpp +++ b/clang/tools/clang-installapi/Options.cpp @@ -801,8 +801,7 @@ std::pair<LibAttrs, ReexportedInterfaces> Options::getReexportedLibraries() { PathSeq FwkSearchPaths(FEOpts.FwkPaths.begin(), FEOpts.FwkPaths.end()); for (const PlatformType P : Platforms) { PathSeq PlatformSearchPaths = getPathsForPlatform(FEOpts.SystemFwkPaths, P); - FwkSearchPaths.insert(FwkSearchPaths.end(), PlatformSearchPaths.begin(), - PlatformSearchPaths.end()); + llvm::append_range(FwkSearchPaths, PlatformSearchPaths); for (const StringMapEntry<ArchitectureSet> &Lib : LinkerOpts.ReexportedFrameworks) { std::string Name = (Lib.getKey() + ".framework/" + Lib.getKey()).str(); diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp index b58241fd8c4e8..86997524fd49b 100644 --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp @@ -165,8 +165,7 @@ class MacroCallReconstructorTest : public testing::Test { UnwrappedLine Result; Result.Level = Level; for (const Chunk &Chunk : Chunks) { - Result.Tokens.insert(Result.Tokens.end(), Chunk.Tokens.begin(), - Chunk.Tokens.end()); + llvm::append_range(Result.Tokens, Chunk.Tokens); assert(!Result.Tokens.empty()); Result.Tokens.back().Children.append(Chunk.Children.begin(), Chunk.Children.end()); `````````` </details> https://github.com/llvm/llvm-project/pull/136448 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits