mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:42:01 +01:00
Replace is_sorted with comparison (#1104)
* Replace is_sorted with comparison * Switch to StringRefContainsPointer
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "common/check.h"
|
||||
#include "common/string_helpers.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
@@ -901,8 +902,7 @@ auto TokenizedBuffer::TokenIterator::Print(llvm::raw_ostream& output) const
|
||||
|
||||
auto TokenizedBuffer::SourceBufferLocationTranslator::GetLocation(
|
||||
const char* loc) -> Diagnostic::Location {
|
||||
CHECK(llvm::is_sorted(std::array{buffer_->source_->Text().begin(), loc,
|
||||
buffer_->source_->Text().end()}))
|
||||
CHECK(StringRefContainsPointer(buffer_->source_->Text(), loc))
|
||||
<< "location not within buffer";
|
||||
int64_t offset = loc - buffer_->source_->Text().begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user