]> granicus.if.org Git - clang/commitdiff
Use the container form llvm::sort(C, ...)
authorFangrui Song <maskray@google.com>
Sun, 30 Sep 2018 21:41:11 +0000 (21:41 +0000)
committerFangrui Song <maskray@google.com>
Sun, 30 Sep 2018 21:41:11 +0000 (21:41 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343425 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Serialization/ContinuousRangeMap.h
lib/AST/ASTContext.cpp
lib/AST/VTableBuilder.cpp
lib/ASTMatchers/Dynamic/Parser.cpp
lib/Basic/Targets.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Frontend/CompilerInvocation.cpp
lib/Sema/SemaDecl.cpp
utils/TableGen/ClangAttrEmitter.cpp
utils/TableGen/ClangDiagnosticsEmitter.cpp

index 73bf2ed10f04444f497617e87861447d6f9d52a0..ad827e37db2d717e9fb8ba4579ee746976d24a4c 100644 (file)
@@ -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
index 3d0d1e666cd42f5259ebdbc163eada4e23cc4e1c..21bdc096ae37402239166aab70f06d9514f2ef54 100644 (file)
@@ -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(
index 46844daf3b360bb6ffbe401e7714d18bd49016b1..81e3c947801dd36c09af89e94f8c6e5ccd09f04a 100644 (file)
@@ -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() { }
index 96362cd4bc61519f30412392a902b57c3b6ba0a5..2f6238b546bf6e8294e3f8aa903eacab3529b541 100644 (file)
@@ -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;
 }
index 1ef2fe3b8141659c0f06093644bb469889a8b765..1a2f4145f10baa3eba38954416a382007e51cd0d 100644 (file)
@@ -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;
index c2fb4797ccdd18e22e388259d48cc314504f5334..dbea1fc7112b5465c5599db1edb5053bcfdbcaa1 100644 (file)
@@ -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);
       });
index 782c7964527a2e2749e46541d8ee28d8b9d96abc..d4236615015e523f012359348e8a95f9ce34605d 100644 (file)
@@ -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
index d02b9712308e017bb098aed5af02fd9112f36361..f5ba87f635d4b591f915e7eb5f5d15b4ad812375 100644 (file)
@@ -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 =
index 5386ea6c317062090c53d14ef898924747f04e9b..59eab3977335815decffbdab05661b0f86c922b7 100644 (file)
@@ -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.
index 782b71307377f1c118e4fb2abdff8c66516e95b1..f551d93282276fbd09a9ba4177e97118e023bffc 100644 (file)
@@ -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 << "`_";