mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 01:29:52 +00:00
Use the container form llvm::sort(C, ...)
There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. llvm-svn: 343425
This commit is contained in:
parent
f21083870d
commit
1d38c13f6e
@ -118,7 +118,7 @@ public:
|
||||
Builder &operator=(const Builder&) = delete;
|
||||
|
||||
~Builder() {
|
||||
llvm::sort(Self.Rep.begin(), Self.Rep.end(), Compare());
|
||||
llvm::sort(Self.Rep, Compare());
|
||||
std::unique(Self.Rep.begin(), Self.Rep.end(),
|
||||
[](const_reference A, const_reference B) {
|
||||
// FIXME: we should not allow any duplicate keys, but there are a lot of
|
||||
|
@ -2295,12 +2295,11 @@ structHasUniqueObjectRepresentations(const ASTContext &Context,
|
||||
}
|
||||
}
|
||||
|
||||
llvm::sort(
|
||||
Bases.begin(), Bases.end(), [&](const std::pair<QualType, int64_t> &L,
|
||||
const std::pair<QualType, int64_t> &R) {
|
||||
return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
|
||||
Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
|
||||
});
|
||||
llvm::sort(Bases, [&](const std::pair<QualType, int64_t> &L,
|
||||
const std::pair<QualType, int64_t> &R) {
|
||||
return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
|
||||
Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
|
||||
});
|
||||
|
||||
for (const auto Base : Bases) {
|
||||
int64_t BaseOffset = Context.toBits(
|
||||
|
@ -2205,13 +2205,12 @@ VTableLayout::VTableLayout(ArrayRef<size_t> VTableIndices,
|
||||
else
|
||||
this->VTableIndices = OwningArrayRef<size_t>(VTableIndices);
|
||||
|
||||
llvm::sort(this->VTableThunks.begin(), this->VTableThunks.end(),
|
||||
[](const VTableLayout::VTableThunkTy &LHS,
|
||||
const VTableLayout::VTableThunkTy &RHS) {
|
||||
assert((LHS.first != RHS.first || LHS.second == RHS.second) &&
|
||||
"Different thunks should have unique indices!");
|
||||
return LHS.first < RHS.first;
|
||||
});
|
||||
llvm::sort(this->VTableThunks, [](const VTableLayout::VTableThunkTy &LHS,
|
||||
const VTableLayout::VTableThunkTy &RHS) {
|
||||
assert((LHS.first != RHS.first || LHS.second == RHS.second) &&
|
||||
"Different thunks should have unique indices!");
|
||||
return LHS.first < RHS.first;
|
||||
});
|
||||
}
|
||||
|
||||
VTableLayout::~VTableLayout() { }
|
||||
|
@ -645,12 +645,12 @@ Parser::completeExpression(StringRef Code, unsigned CompletionOffset, Sema *S,
|
||||
P.parseExpressionImpl(&Dummy);
|
||||
|
||||
// Sort by specificity, then by name.
|
||||
llvm::sort(P.Completions.begin(), P.Completions.end(),
|
||||
llvm::sort(P.Completions,
|
||||
[](const MatcherCompletion &A, const MatcherCompletion &B) {
|
||||
if (A.Specificity != B.Specificity)
|
||||
return A.Specificity > B.Specificity;
|
||||
return A.TypedText < B.TypedText;
|
||||
});
|
||||
if (A.Specificity != B.Specificity)
|
||||
return A.Specificity > B.Specificity;
|
||||
return A.TypedText < B.TypedText;
|
||||
});
|
||||
|
||||
return P.Completions;
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,
|
||||
Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str());
|
||||
// Sort here, so we handle the features in a predictable order. (This matters
|
||||
// when we're dealing with features that overlap.)
|
||||
llvm::sort(Opts->Features.begin(), Opts->Features.end());
|
||||
llvm::sort(Opts->Features);
|
||||
|
||||
if (!Target->handleTargetFeatures(Opts->Features, Diags))
|
||||
return nullptr;
|
||||
|
@ -2554,9 +2554,8 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
|
||||
}
|
||||
|
||||
llvm::sort(
|
||||
Options.begin(), Options.end(),
|
||||
[](const CodeGenFunction::MultiVersionResolverOption &LHS,
|
||||
const CodeGenFunction::MultiVersionResolverOption &RHS) {
|
||||
Options, [](const CodeGenFunction::MultiVersionResolverOption &LHS,
|
||||
const CodeGenFunction::MultiVersionResolverOption &RHS) {
|
||||
return CodeGenFunction::GetX86CpuSupportsMask(LHS.Conditions.Features) >
|
||||
CodeGenFunction::GetX86CpuSupportsMask(RHS.Conditions.Features);
|
||||
});
|
||||
|
@ -1339,7 +1339,7 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
Success = false;
|
||||
}
|
||||
else
|
||||
llvm::sort(Opts.VerifyPrefixes.begin(), Opts.VerifyPrefixes.end());
|
||||
llvm::sort(Opts.VerifyPrefixes);
|
||||
DiagnosticLevelMask DiagMask = DiagnosticLevelMask::None;
|
||||
Success &= parseDiagnosticLevelMask("-verify-ignore-unexpected=",
|
||||
Args.getAllArgValues(OPT_verify_ignore_unexpected_EQ),
|
||||
@ -2502,7 +2502,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
||||
Opts.CurrentModule = Opts.ModuleName;
|
||||
Opts.AppExt = Args.hasArg(OPT_fapplication_extension);
|
||||
Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
|
||||
llvm::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end());
|
||||
llvm::sort(Opts.ModuleFeatures);
|
||||
Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
|
||||
Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns);
|
||||
// Enable HalfArgsAndReturns if present in Args or if NativeHalfArgsAndReturns
|
||||
|
@ -9596,7 +9596,7 @@ static bool CheckTargetCausesMultiVersioning(
|
||||
const auto *OldTA = OldFD->getAttr<TargetAttr>();
|
||||
TargetAttr::ParsedTargetAttr NewParsed = NewTA->parse();
|
||||
// Sort order doesn't matter, it just needs to be consistent.
|
||||
llvm::sort(NewParsed.Features.begin(), NewParsed.Features.end());
|
||||
llvm::sort(NewParsed.Features);
|
||||
|
||||
// If the old decl is NOT MultiVersioned yet, and we don't cause that
|
||||
// to change, this is a simple redeclaration.
|
||||
@ -9682,7 +9682,7 @@ static bool CheckMultiVersionAdditionalDecl(
|
||||
TargetAttr::ParsedTargetAttr NewParsed;
|
||||
if (NewTA) {
|
||||
NewParsed = NewTA->parse();
|
||||
llvm::sort(NewParsed.Features.begin(), NewParsed.Features.end());
|
||||
llvm::sort(NewParsed.Features);
|
||||
}
|
||||
|
||||
bool UseMemberUsingDeclRules =
|
||||
|
@ -3961,10 +3961,10 @@ void EmitClangAttrDocs(RecordKeeper &Records, raw_ostream &OS) {
|
||||
for (auto &I : SplitDocs) {
|
||||
WriteCategoryHeader(I.first, OS);
|
||||
|
||||
llvm::sort(I.second.begin(), I.second.end(),
|
||||
llvm::sort(I.second,
|
||||
[](const DocumentationData &D1, const DocumentationData &D2) {
|
||||
return D1.Heading < D2.Heading;
|
||||
});
|
||||
});
|
||||
|
||||
// Walk over each of the attributes in the category and write out their
|
||||
// documentation.
|
||||
|
@ -1763,7 +1763,7 @@ void EmitClangDiagDocs(RecordKeeper &Records, raw_ostream &OS) {
|
||||
OS << "Also controls ";
|
||||
|
||||
bool First = true;
|
||||
llvm::sort(GroupInfo.SubGroups.begin(), GroupInfo.SubGroups.end());
|
||||
llvm::sort(GroupInfo.SubGroups);
|
||||
for (const auto &Name : GroupInfo.SubGroups) {
|
||||
if (!First) OS << ", ";
|
||||
OS << "`" << (IsRemarkGroup ? "-R" : "-W") << Name << "`_";
|
||||
|
Loading…
Reference in New Issue
Block a user