Skip to content

Commit 76bbbcb

Browse files
[clang-tidy] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
1 parent 88d319a commit 76bbbcb

33 files changed

+69
-67
lines changed

clang-tools-extra/clang-tidy/ClangTidy.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static CheckersList getAnalyzerCheckersAndPackages(ClangTidyContext &Context,
390390
for (StringRef CheckName : RegisteredCheckers) {
391391
std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
392392

393-
if (CheckName.startswith("core") ||
393+
if (CheckName.starts_with("core") ||
394394
Context.isCheckEnabled(ClangTidyCheckName)) {
395395
List.emplace_back(std::string(CheckName), true);
396396
}
@@ -541,7 +541,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
541541
CommandLineArguments AdjustedArgs = Args;
542542
if (Opts.ExtraArgsBefore) {
543543
auto I = AdjustedArgs.begin();
544-
if (I != AdjustedArgs.end() && !StringRef(*I).startswith("-"))
544+
if (I != AdjustedArgs.end() && !StringRef(*I).starts_with("-"))
545545
++I; // Skip compiler binary name, if it is there.
546546
AdjustedArgs.insert(I, Opts.ExtraArgsBefore->begin(),
547547
Opts.ExtraArgsBefore->end());

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
6262
// appending the check name to the message in ClangTidyContext::diag and
6363
// using getCustomDiagID.
6464
std::string CheckNameInMessage = " [" + Error.DiagnosticName + "]";
65-
if (Message.endswith(CheckNameInMessage))
65+
if (Message.ends_with(CheckNameInMessage))
6666
Message = Message.substr(0, Message.size() - CheckNameInMessage.size());
6767

6868
auto TidyMessage =
@@ -457,7 +457,7 @@ bool ClangTidyDiagnosticConsumer::passesLineFilter(StringRef FileName,
457457
if (Context.getGlobalOptions().LineFilter.empty())
458458
return true;
459459
for (const FileFilter &Filter : Context.getGlobalOptions().LineFilter) {
460-
if (FileName.endswith(Filter.Name)) {
460+
if (FileName.ends_with(Filter.Name)) {
461461
if (Filter.LineRanges.empty())
462462
return true;
463463
for (const FileFilter::LineRange &Range : Filter.LineRanges) {

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class ExpandModularHeadersPPCallbacks::FileRecorder {
2323
/// Records that a given file entry is needed for replaying callbacks.
2424
void addNecessaryFile(FileEntryRef File) {
2525
// Don't record modulemap files because it breaks same file detection.
26-
if (!(File.getName().endswith("module.modulemap") ||
27-
File.getName().endswith("module.private.modulemap") ||
28-
File.getName().endswith("module.map") ||
29-
File.getName().endswith("module_private.map")))
26+
if (!(File.getName().ends_with("module.modulemap") ||
27+
File.getName().ends_with("module.private.modulemap") ||
28+
File.getName().ends_with("module.map") ||
29+
File.getName().ends_with("module_private.map")))
3030
FilesToRecord.insert(File);
3131
}
3232

clang-tools-extra/clang-tidy/GlobList.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace clang::tidy {
1616
// from the GlobList.
1717
static bool consumeNegativeIndicator(StringRef &GlobList) {
1818
GlobList = GlobList.trim();
19-
if (GlobList.startswith("-")) {
19+
if (GlobList.starts_with("-")) {
2020
GlobList = GlobList.substr(1);
2121
return true;
2222
}

clang-tools-extra/clang-tidy/abseil/AbseilMatcher.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ AST_POLYMORPHIC_MATCHER(
5252
"profiling", "random", "status", "strings", "synchronization",
5353
"time", "types", "utility"};
5454
return llvm::any_of(AbseilLibraries, [&](const char *Library) {
55-
return Path.startswith(Library);
55+
return Path.starts_with(Library);
5656
});
5757
}
5858

clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ std::optional<std::string> makeCharacterLiteral(const StringLiteral *Literal,
2727
assert(Literal->getCharByteWidth() == 1 &&
2828
"StrSplit doesn't support wide char");
2929
std::string Result = clang::tooling::fixit::getText(*Literal, Context).str();
30-
bool IsRawStringLiteral = StringRef(Result).startswith(R"(R")");
30+
bool IsRawStringLiteral = StringRef(Result).starts_with(R"(R")");
3131
// Since raw string literal might contain unescaped non-printable characters,
3232
// we normalize them using `StringLiteral::outputString`.
3333
if (IsRawStringLiteral) {

clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static bool sameName(StringRef InComment, StringRef InDecl, bool StrictMode) {
185185
static bool looksLikeExpectMethod(const CXXMethodDecl *Expect) {
186186
return Expect != nullptr && Expect->getLocation().isMacroID() &&
187187
Expect->getNameInfo().getName().isIdentifier() &&
188-
Expect->getName().startswith("gmock_");
188+
Expect->getName().starts_with("gmock_");
189189
}
190190
static bool areMockAndExpectMethods(const CXXMethodDecl *Mock,
191191
const CXXMethodDecl *Expect) {

clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ static bool isIgnoredParameter(const TheCheck &Check, const ParmVarDecl *Node) {
15501550
if (!NodeTypeName.empty()) {
15511551
if (llvm::any_of(Check.IgnoredParameterTypeSuffixes,
15521552
[NodeTypeName](StringRef E) {
1553-
return !E.empty() && NodeTypeName.endswith(E);
1553+
return !E.empty() && NodeTypeName.ends_with(E);
15541554
})) {
15551555
LLVM_DEBUG(llvm::dbgs() << "\tType suffix ignored.\n");
15561556
return true;

clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static bool isDestExprFix(const MatchFinder::MatchResult &Result,
385385

386386
std::string TempTyStr = Dest->getType().getAsString();
387387
StringRef TyStr = TempTyStr;
388-
if (TyStr.startswith("char") || TyStr.startswith("wchar_t"))
388+
if (TyStr.starts_with("char") || TyStr.starts_with("wchar_t"))
389389
return false;
390390

391391
Diag << FixItHint::CreateInsertion(Dest->getBeginLoc(), "(char *)");
@@ -721,8 +721,8 @@ void NotNullTerminatedResultCheck::registerMatchers(MatchFinder *Finder) {
721721

722722
// Try to match with 'wchar_t' based function calls.
723723
std::string WcharHandlerFuncName =
724-
"::" + (CC.Name.startswith("mem") ? "w" + CC.Name.str()
725-
: "wcs" + CC.Name.substr(3).str());
724+
"::" + (CC.Name.starts_with("mem") ? "w" + CC.Name.str()
725+
: "wcs" + CC.Name.substr(3).str());
726726

727727
return allOf(callee(functionDecl(
728728
hasAnyName(CharHandlerFuncName, WcharHandlerFuncName))),
@@ -820,13 +820,13 @@ void NotNullTerminatedResultCheck::check(
820820
}
821821

822822
StringRef Name = FunctionExpr->getDirectCallee()->getName();
823-
if (Name.startswith("mem") || Name.startswith("wmem"))
823+
if (Name.starts_with("mem") || Name.starts_with("wmem"))
824824
memoryHandlerFunctionFix(Name, Result);
825825
else if (Name == "strerror_s")
826826
strerror_sFix(Result);
827-
else if (Name.endswith("ncmp"))
827+
else if (Name.ends_with("ncmp"))
828828
ncmpFix(Name, Result);
829-
else if (Name.endswith("xfrm"))
829+
else if (Name.ends_with("xfrm"))
830830
xfrmFix(Name, Result);
831831
}
832832

@@ -835,7 +835,7 @@ void NotNullTerminatedResultCheck::memoryHandlerFunctionFix(
835835
if (isCorrectGivenLength(Result))
836836
return;
837837

838-
if (Name.endswith("chr")) {
838+
if (Name.ends_with("chr")) {
839839
memchrFix(Name, Result);
840840
return;
841841
}
@@ -849,13 +849,13 @@ void NotNullTerminatedResultCheck::memoryHandlerFunctionFix(
849849
"the result from calling '%0' is not null-terminated")
850850
<< Name;
851851

852-
if (Name.endswith("cpy")) {
852+
if (Name.ends_with("cpy")) {
853853
memcpyFix(Name, Result, Diag);
854-
} else if (Name.endswith("cpy_s")) {
854+
} else if (Name.ends_with("cpy_s")) {
855855
memcpy_sFix(Name, Result, Diag);
856-
} else if (Name.endswith("move")) {
856+
} else if (Name.ends_with("move")) {
857857
memmoveFix(Name, Result, Diag);
858-
} else if (Name.endswith("move_s")) {
858+
} else if (Name.ends_with("move_s")) {
859859
isDestCapacityFix(Result, Diag);
860860
lengthArgHandle(LengthHandleKind::Increase, Result, Diag);
861861
}

clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static bool hasReservedDoubleUnderscore(StringRef Name,
8181
const LangOptions &LangOpts) {
8282
if (LangOpts.CPlusPlus)
8383
return Name.contains("__");
84-
return Name.startswith("__");
84+
return Name.starts_with("__");
8585
}
8686

8787
static std::optional<std::string>

clang-tools-extra/clang-tidy/bugprone/SignalHandlerCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ bool isStandardFunction(const FunctionDecl *FD) {
282282
/// and every other statement that is declared in file ExprCXX.h.
283283
bool isCXXOnlyStmt(const Stmt *S) {
284284
StringRef Name = S->getStmtClassName();
285-
if (Name.startswith("CXX"))
285+
if (Name.starts_with("CXX"))
286286
return true;
287287
// Check for all other class names in ExprCXX.h that have no 'CXX' prefix.
288288
return isa<ArrayTypeTraitExpr, BuiltinBitCastExpr, CUDAKernelCallExpr,

clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,15 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
148148
return;
149149
// Ignore code in .c files and headers included from them, even if they are
150150
// compiled as C++.
151-
if (getCurrentMainFile().endswith(".c"))
151+
if (getCurrentMainFile().ends_with(".c"))
152152
return;
153153

154154
SourceManager &SM = *Result.SourceManager;
155155

156156
// Ignore code in .c files #included in other files (which shouldn't be done,
157157
// but people still do this for test and other purposes).
158-
if (SM.getFilename(SM.getSpellingLoc(CastExpr->getBeginLoc())).endswith(".c"))
158+
if (SM.getFilename(SM.getSpellingLoc(CastExpr->getBeginLoc()))
159+
.ends_with(".c"))
159160
return;
160161

161162
// Leave type spelling exactly as it was (unlike

clang-tools-extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
6666
// recent enough version of Google Test.
6767
llvm::StringRef FileName = PP->getSourceManager().getFilename(
6868
MD->getMacroInfo()->getDefinitionLoc());
69-
ReplacementFound = FileName.endswith("gtest/gtest-typed-test.h") &&
69+
ReplacementFound = FileName.ends_with("gtest/gtest-typed-test.h") &&
7070
PP->getSpelling(MacroNameTok) == "TYPED_TEST_SUITE";
7171
}
7272
}
@@ -102,7 +102,7 @@ class UpgradeGoogletestCasePPCallback : public PPCallbacks {
102102

103103
llvm::StringRef FileName = PP->getSourceManager().getFilename(
104104
MD.getMacroInfo()->getDefinitionLoc());
105-
if (!FileName.endswith("gtest/gtest-typed-test.h"))
105+
if (!FileName.ends_with("gtest/gtest-typed-test.h"))
106106
return;
107107

108108
DiagnosticBuilder Diag = Check->diag(Loc, RenameCaseToSuiteMessage);

clang-tools-extra/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void UsingNamespaceDirectiveCheck::check(
4040

4141
bool UsingNamespaceDirectiveCheck::isStdLiteralsNamespace(
4242
const NamespaceDecl *NS) {
43-
if (!NS->getName().endswith("literals"))
43+
if (!NS->getName().ends_with("literals"))
4444
return false;
4545

4646
const auto *Parent = dyn_cast_or_null<NamespaceDecl>(NS->getParent());

clang-tools-extra/clang-tidy/llvm/HeaderGuardCheck.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ std::string LLVMHeaderGuardCheck::getHeaderGuard(StringRef Filename,
5454
std::replace(Guard.begin(), Guard.end(), '-', '_');
5555

5656
// The prevalent style in clang is LLVM_CLANG_FOO_BAR_H
57-
if (StringRef(Guard).startswith("clang"))
57+
if (StringRef(Guard).starts_with("clang"))
5858
Guard = "LLVM_" + Guard;
5959

6060
// The prevalent style in flang is FORTRAN_FOO_BAR_H
61-
if (StringRef(Guard).startswith("flang"))
61+
if (StringRef(Guard).starts_with("flang"))
6262
Guard = "FORTRAN" + Guard.substr(sizeof("flang") - 1);
6363

6464
return StringRef(Guard).upper();

clang-tools-extra/clang-tidy/llvm/IncludeOrderCheck.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
6161
return 0;
6262

6363
// LLVM and clang headers are in the penultimate position.
64-
if (Filename.startswith("llvm/") || Filename.startswith("llvm-c/") ||
65-
Filename.startswith("clang/") || Filename.startswith("clang-c/"))
64+
if (Filename.starts_with("llvm/") || Filename.starts_with("llvm-c/") ||
65+
Filename.starts_with("clang/") || Filename.starts_with("clang-c/"))
6666
return 2;
6767

6868
// Put these between system and llvm headers to be consistent with LLVM
6969
// clang-format style.
70-
if (Filename.startswith("gtest/") || Filename.startswith("gmock/"))
70+
if (Filename.starts_with("gtest/") || Filename.starts_with("gmock/"))
7171
return 3;
7272

7373
// System headers are sorted to the end.

clang-tools-extra/clang-tidy/misc/ConfusableTable/BuildConfusableTable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main(int argc, char *argv[]) {
2727
std::vector<std::pair<llvm::UTF32, SmallVector<llvm::UTF32>>> Entries;
2828
SmallVector<StringRef> Values;
2929
for (StringRef Line : Lines) {
30-
if (Line.startswith("#"))
30+
if (Line.starts_with("#"))
3131
continue;
3232

3333
Values.clear();

clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult &Result) {
180180
// Since most private -> public mappings happen in a verbatim way, we
181181
// check textually here. This might go wrong in presence of symlinks or
182182
// header mappings. But that's not different than rest of the places.
183-
if (getCurrentMainFile().endswith(PHeader))
183+
if (getCurrentMainFile().ends_with(PHeader))
184184
continue;
185185
}
186186
auto StdHeader = tooling::stdlib::Header::named(

clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ void RedundantExpressionCheck::check(const MatchFinder::MatchResult &Result) {
12851285

12861286
const auto Diag = diag(Op->getExprLoc(), Message);
12871287
for (const auto &KeyValue : Result.Nodes.getMap()) {
1288-
if (StringRef(KeyValue.first).startswith("duplicate"))
1288+
if (StringRef(KeyValue.first).starts_with("duplicate"))
12891289
Diag << KeyValue.second.getSourceRange();
12901290
}
12911291
}

clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -849,14 +849,14 @@ std::string VariableNamer::createIndexName() {
849849
ContainerName = TheContainer->getName();
850850

851851
size_t Len = ContainerName.size();
852-
if (Len > 1 && ContainerName.endswith(Style == NS_UpperCase ? "S" : "s")) {
852+
if (Len > 1 && ContainerName.ends_with(Style == NS_UpperCase ? "S" : "s")) {
853853
IteratorName = std::string(ContainerName.substr(0, Len - 1));
854854
// E.g.: (auto thing : things)
855855
if (!declarationExists(IteratorName) || IteratorName == OldIndex->getName())
856856
return IteratorName;
857857
}
858858

859-
if (Len > 2 && ContainerName.endswith(Style == NS_UpperCase ? "S_" : "s_")) {
859+
if (Len > 2 && ContainerName.ends_with(Style == NS_UpperCase ? "S_" : "s_")) {
860860
IteratorName = std::string(ContainerName.substr(0, Len - 2));
861861
// E.g.: (auto thing : things_)
862862
if (!declarationExists(IteratorName) || IteratorName == OldIndex->getName())

clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void ReplaceRandomShuffleCheck::check(const MatchFinder::MatchResult &Result) {
8383
StringRef ContainerText = Lexer::getSourceText(
8484
CharSourceRange::getTokenRange(MatchedDecl->getSourceRange()),
8585
*Result.SourceManager, getLangOpts());
86-
if (ContainerText.startswith("std::"))
86+
if (ContainerText.starts_with("std::"))
8787
NewName = "std::" + NewName;
8888

8989
Diag << FixItHint::CreateRemoval(MatchedDecl->getSourceRange());

clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ AST_MATCHER_P(NamedDecl, hasAnyNameIgnoringTemplates, std::vector<StringRef>,
4141
// FullNameTrimmed matches any of the given Names.
4242
const StringRef FullNameTrimmedRef = FullNameTrimmed;
4343
for (const StringRef Pattern : Names) {
44-
if (Pattern.startswith("::")) {
44+
if (Pattern.starts_with("::")) {
4545
if (FullNameTrimmed == Pattern)
4646
return true;
47-
} else if (FullNameTrimmedRef.endswith(Pattern) &&
48-
FullNameTrimmedRef.drop_back(Pattern.size()).endswith("::")) {
47+
} else if (FullNameTrimmedRef.ends_with(Pattern) &&
48+
FullNameTrimmedRef.drop_back(Pattern.size()).ends_with("::")) {
4949
return true;
5050
}
5151
}

clang-tools-extra/clang-tidy/modernize/UseNodiscardCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static bool doesNoDiscardMacroExist(ASTContext &Context,
2020
const llvm::StringRef &MacroId) {
2121
// Don't check for the Macro existence if we are using an attribute
2222
// either a C++17 standard attribute or pre C++17 syntax
23-
if (MacroId.startswith("[[") || MacroId.startswith("__attribute__"))
23+
if (MacroId.starts_with("[[") || MacroId.starts_with("__attribute__"))
2424
return true;
2525

2626
// Otherwise look up the macro name in the context to see if its defined.

clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ClangTidyPluginAction : public PluginASTAction {
6262
// Parse the extra command line args.
6363
// FIXME: This is very limited at the moment.
6464
for (StringRef Arg : Args)
65-
if (Arg.startswith("-checks="))
65+
if (Arg.starts_with("-checks="))
6666
OverrideOptions.Checks = std::string(Arg.substr(strlen("-checks=")));
6767

6868
auto Options = std::make_unique<FileOptionsProvider>(

clang-tools-extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ static StringRef trySuggestX86(StringRef Name) {
5959
return {};
6060

6161
// [simd.alg]
62-
if (Name.startswith("max_"))
62+
if (Name.starts_with("max_"))
6363
return "$simd::max";
64-
if (Name.startswith("min_"))
64+
if (Name.starts_with("min_"))
6565
return "$simd::min";
6666

6767
// [simd.binary]
68-
if (Name.startswith("add_"))
68+
if (Name.starts_with("add_"))
6969
return "operator+ on $simd objects";
70-
if (Name.startswith("sub_"))
70+
if (Name.starts_with("sub_"))
7171
return "operator- on $simd objects";
72-
if (Name.startswith("mul_"))
72+
if (Name.starts_with("mul_"))
7373
return "operator* on $simd objects";
7474

7575
return {};

clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static SourceLocation findEndLocation(const Stmt &S, const SourceManager &SM,
7979
SourceRange TokRange(Loc, TokEndLoc);
8080
StringRef Comment = Lexer::getSourceText(
8181
CharSourceRange::getTokenRange(TokRange), SM, Context->getLangOpts());
82-
if (Comment.startswith("/*") && Comment.contains('\n')) {
82+
if (Comment.starts_with("/*") && Comment.contains('\n')) {
8383
// Multi-line block comment, insert brace before.
8484
break;
8585
}

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ bool IdentifierNamingCheck::matchesStyle(
889889

890890
// Ensure the name doesn't have any extra underscores beyond those specified
891891
// in the prefix and suffix.
892-
if (Name.startswith("_") || Name.endswith("_"))
892+
if (Name.starts_with("_") || Name.ends_with("_"))
893893
return false;
894894

895895
if (Style.Case && !Matchers[static_cast<size_t>(*Style.Case)].match(Name))

clang-tools-extra/clang-tidy/readability/IsolateDeclarationCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ createIsolatedDecls(llvm::ArrayRef<StringRef> Snippets) {
235235

236236
for (std::size_t I = 1; I < Snippets.size(); ++I)
237237
Decls[I - 1] = Twine(Snippets[0])
238-
.concat(Snippets[0].endswith(" ") ? "" : " ")
238+
.concat(Snippets[0].ends_with(" ") ? "" : " ")
239239
.concat(Snippets[I].ltrim())
240240
.concat(";")
241241
.str();

0 commit comments

Comments
 (0)