summaryrefslogtreecommitdiff
path: root/lib/Basic
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-07-03 08:13:17 +0000
committerFangrui Song <maskray@google.com>2019-07-03 08:13:17 +0000
commitb76b345fe11bc58f9e5037556f1a46b890d41cbf (patch)
tree21c4b0457fb4b2e0c16780c4d444c0b47e226bc1 /lib/Basic
parent41b948059d69589ab50840275e5fb4a2bd63f8bf (diff)
downloadclang-b76b345fe11bc58f9e5037556f1a46b890d41cbf.tar.gz
Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic')
-rw-r--r--lib/Basic/Diagnostic.cpp7
-rw-r--r--lib/Basic/DiagnosticIDs.cpp7
-rw-r--r--lib/Basic/SourceManager.cpp6
3 files changed, 8 insertions, 12 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index c95681496a..c82f74413e 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -205,10 +205,9 @@ DiagnosticsEngine::DiagStateMap::lookup(SourceManager &SrcMgr,
DiagnosticsEngine::DiagState *
DiagnosticsEngine::DiagStateMap::File::lookup(unsigned Offset) const {
- auto OnePastIt = std::upper_bound(
- StateTransitions.begin(), StateTransitions.end(), Offset,
- [](unsigned Offset, const DiagStatePoint &P) {
- return Offset < P.Offset;
+ auto OnePastIt =
+ llvm::partition_point(StateTransitions, [=](const DiagStatePoint &P) {
+ return P.Offset <= Offset;
});
assert(OnePastIt != StateTransitions.begin() && "missing initial state");
return OnePastIt[-1].State;
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index e8a99d08a9..f189e5de49 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -580,11 +580,8 @@ static bool getDiagnosticsInGroup(diag::Flavor Flavor,
bool
DiagnosticIDs::getDiagnosticsInGroup(diag::Flavor Flavor, StringRef Group,
SmallVectorImpl<diag::kind> &Diags) const {
- auto Found = std::lower_bound(std::begin(OptionTable), std::end(OptionTable),
- Group,
- [](const WarningOption &LHS, StringRef RHS) {
- return LHS.getName() < RHS;
- });
+ auto Found = llvm::partition_point(
+ OptionTable, [=](const WarningOption &O) { return O.getName() < Group; });
if (Found == std::end(OptionTable) || Found->getName() != Group)
return true; // Option not found.
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp
index 8d56b19b10..c57f1fd856 100644
--- a/lib/Basic/SourceManager.cpp
+++ b/lib/Basic/SourceManager.cpp
@@ -277,9 +277,9 @@ const LineEntry *LineTableInfo::FindNearestLineEntry(FileID FID,
return &Entries.back();
// Do a binary search to find the maximal element that is still before Offset.
- std::vector<LineEntry>::const_iterator I =
- std::upper_bound(Entries.begin(), Entries.end(), Offset);
- if (I == Entries.begin()) return nullptr;
+ std::vector<LineEntry>::const_iterator I = llvm::upper_bound(Entries, Offset);
+ if (I == Entries.begin())
+ return nullptr;
return &*--I;
}