Skip to content

Commit 1b8b39e

Browse files
committed
StringRef ends/startswith-lower -> insensitive
Updating StringRef startswith and endswith API to use insensitive rather than lower.
1 parent e21e70a commit 1b8b39e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

lib/AST/DocComment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ bool extractSeparatedParams(
191191
auto ParagraphContent = ParagraphText->getLiteralContent();
192192
auto PotentialMatch = ParagraphContent.substr(0, ParameterPrefix.size());
193193

194-
if (!PotentialMatch.startswith_lower(ParameterPrefix)) {
194+
if (!PotentialMatch.startswith_insensitive(ParameterPrefix)) {
195195
NormalItems.push_back(Child);
196196
continue;
197197
}

lib/Basic/StringExtras.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ static bool matchNameWordToTypeWord(StringRef nameWord, StringRef typeWord) {
392392
// We can match the suffix of the type so long as everything preceding the
393393
// match is neither a lowercase letter nor a '_'. This ignores type
394394
// prefixes for acronyms, e.g., the 'NS' in 'NSURL'.
395-
if (typeWord.endswith_lower(nameWord) &&
396-
!clang::isLowercase(typeWord[typeWord.size()-nameWord.size()])) {
395+
if (typeWord.endswith_insensitive(nameWord) &&
396+
!clang::isLowercase(typeWord[typeWord.size() - nameWord.size()])) {
397397
// Check that everything preceding the match is neither a lowercase letter
398398
// nor a '_'.
399399
for (unsigned i = 0, n = nameWord.size(); i != n; ++i) {
@@ -405,7 +405,7 @@ static bool matchNameWordToTypeWord(StringRef nameWord, StringRef typeWord) {
405405

406406
// We can match a prefix so long as everything following the match is
407407
// a number.
408-
if (typeWord.startswith_lower(nameWord)) {
408+
if (typeWord.startswith_insensitive(nameWord)) {
409409
for (unsigned i = nameWord.size(), n = typeWord.size(); i != n; ++i) {
410410
if (!clang::isDigit(typeWord[i])) return false;
411411
}

lib/IRGen/IRGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ llvm::SmallString<32> getTargetDependentLibraryOption(const llvm::Triple &T,
12241224
if (quote)
12251225
buffer += '"';
12261226
buffer += library;
1227-
if (!library.endswith_lower(".lib"))
1227+
if (!library.endswith_insensitive(".lib"))
12281228
buffer += ".lib";
12291229
if (quote)
12301230
buffer += '"';

lib/Sema/CSStep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ bool swift::isSIMDOperator(ValueDecl *value) {
756756
if (nominal->getName().empty())
757757
return false;
758758

759-
return nominal->getName().str().startswith_lower("simd");
759+
return nominal->getName().str().startswith_insensitive("simd");
760760
}
761761

762762
bool DisjunctionStep::shortCircuitDisjunctionAt(

tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ void CodeCompletionOrganizer::Impl::addCompletionsWithFilter(
541541
if (options.fuzzyMatching && filterText.size() >= options.minFuzzyLength) {
542542
match = pattern.matchesCandidate(completion->getName());
543543
} else {
544-
match = completion->getName().startswith_lower(filterText);
544+
match = completion->getName().startswith_insensitive(filterText);
545545
}
546546

547547
bool isExactMatch =

0 commit comments

Comments
 (0)