r250621 - Replace a static compare function with a lambda. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 17 13:18:47 PDT 2015


Author: ctopper
Date: Sat Oct 17 15:18:46 2015
New Revision: 250621

URL: http://llvm.org/viewvc/llvm-project?rev=250621&view=rev
Log:
Replace a static compare function with a lambda. NFC

Modified:
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=250621&r1=250620&r2=250621&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Sat Oct 17 15:18:46 2015
@@ -503,10 +503,6 @@ static const WarningOption OptionTable[]
 #undef GET_DIAG_TABLE
 };
 
-static bool WarningOptionCompare(const WarningOption &LHS, StringRef RHS) {
-  return LHS.getName() < RHS;
-}
-
 /// getWarningOptionForDiag - Return the lowest-level warning option that
 /// enables the specified diagnostic.  If there is no -Wfoo flag that controls
 /// the diagnostic, this returns null.
@@ -549,9 +545,11 @@ static bool getDiagnosticsInGroup(diag::
 bool
 DiagnosticIDs::getDiagnosticsInGroup(diag::Flavor Flavor, StringRef Group,
                                      SmallVectorImpl<diag::kind> &Diags) const {
-  const WarningOption *Found = std::lower_bound(std::begin(OptionTable),
-                                                std::end(OptionTable),
-                                                Group, WarningOptionCompare);
+  auto Found = std::lower_bound(std::begin(OptionTable), std::end(OptionTable),
+                                Group,
+                                [](const WarningOption &LHS, StringRef RHS) {
+                                  return LHS.getName() < RHS;
+                                });
   if (Found == std::end(OptionTable) || Found->getName() != Group)
     return true; // Option not found.
 




More information about the cfe-commits mailing list