Skip to content

Commit 9a4c92e

Browse files
committed
Merge bitcoin/bitcoin#32226: ci: switch to LLVM 20 in tidy job
08aa7fe ci: clang-tidy 20 (fanquake) 2b85d31 refactor: starts/ends_with changes for clang-tidy 20 (fanquake) Pull request description: Switch to LLVM 20 in the tidy job. ACKs for top commit: l0rinc: ACK 08aa7fe hebasto: ACK 08aa7fe. Tree-SHA512: 54b6c64adcf7556edf3b30f87935de7868354e8ad252da834796f347a5a77feda01f145f17e5a7419cf6f3b4f87fc2b168c1ec2a2d13bb4e0ffcc0fac667fd42
2 parents 82d1e94 + 08aa7fe commit 9a4c92e

File tree

12 files changed

+17
-17
lines changed

12 files changed

+17
-17
lines changed

ci/test/00_setup_env_native_tidy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
88

99
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
1010
export CONTAINER_NAME=ci_native_tidy
11-
export TIDY_LLVM_V="19"
11+
export TIDY_LLVM_V="20"
1212
export APT_LLVM_V="${TIDY_LLVM_V}"
1313
export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libdb++-dev"
1414
export NO_DEPENDS=1

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ static int CommandLineRPC(int argc, char *argv[])
12201220
if (gArgs.GetBoolArg("-stdinwalletpassphrase", false)) {
12211221
NO_STDIN_ECHO();
12221222
std::string walletPass;
1223-
if (args.size() < 1 || args[0].substr(0, 16) != "walletpassphrase") {
1223+
if (args.size() < 1 || !args[0].starts_with("walletpassphrase")) {
12241224
throw std::runtime_error("-stdinwalletpassphrase is only applicable for walletpassphrase(change)");
12251225
}
12261226
if (!StdinReady()) {

src/common/args.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ KeyInfo InterpretKey(std::string key)
8585
result.section = key.substr(0, option_index);
8686
key.erase(0, option_index + 1);
8787
}
88-
if (key.substr(0, 2) == "no") {
88+
if (key.starts_with("no")) {
8989
key.erase(0, 2);
9090
result.negated = true;
9191
}
@@ -189,7 +189,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
189189
// internet" warning, and clicks the Open button, macOS passes
190190
// a unique process serial number (PSN) as -psn_... command-line
191191
// argument, which we filter out.
192-
if (key.substr(0, 5) == "-psn_") continue;
192+
if (key.starts_with("-psn_")) continue;
193193
#endif
194194

195195
if (key == "-") break; //bitcoin-tx using stdin

src/common/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static bool GetConfigOptions(std::istream& stream, const std::string& filepath,
6565
}
6666
} else {
6767
error = strprintf("parse error on line %i: %s", linenr, str);
68-
if (str.size() >= 2 && str.substr(0, 2) == "no") {
68+
if (str.size() >= 2 && str.starts_with("no")) {
6969
error += strprintf(", if you intended to specify a negated option, use %s=1 instead", str);
7070
}
7171
return false;

src/core_read.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CScript ParseScript(const std::string& s)
8383
}
8484

8585
result << num.value();
86-
} else if (w.substr(0, 2) == "0x" && w.size() > 2 && IsHex(std::string(w.begin() + 2, w.end()))) {
86+
} else if (w.starts_with("0x") && w.size() > 2 && IsHex(std::string(w.begin() + 2, w.end()))) {
8787
// Raw hex data, inserted NOT pushed onto stack:
8888
std::vector<unsigned char> raw = ParseHex(std::string(w.begin() + 2, w.end()));
8989
result.insert(result.end(), raw.begin(), raw.end());

src/httprpc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static bool multiUserAuthorized(std::string strUserPass)
134134

135135
static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUsernameOut)
136136
{
137-
if (strAuth.substr(0, 6) != "Basic ")
137+
if (!strAuth.starts_with("Basic "))
138138
return false;
139139
std::string_view strUserPass64 = TrimStringView(std::string_view{strAuth}.substr(6));
140140
auto userpass_data = DecodeBase64(strUserPass64);

src/i2p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
299299
Reply reply;
300300

301301
// Don't log the full "SESSION CREATE ..." because it contains our private key.
302-
reply.request = request.substr(0, 14) == "SESSION CREATE" ? "SESSION CREATE ..." : request;
302+
reply.request = request.starts_with("SESSION CREATE") ? "SESSION CREATE ..." : request;
303303

304304
// It could take a few minutes for the I2P router to reply as it is querying the I2P network
305305
// (when doing name lookup, for example). Notice: `RecvUntilTerminator()` is checking

src/node/blockstorage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,11 @@ void BlockManager::CleanupBlockRevFiles() const
624624
const std::string path = fs::PathToString(it->path().filename());
625625
if (fs::is_regular_file(*it) &&
626626
path.length() == 12 &&
627-
path.substr(8,4) == ".dat")
627+
path.ends_with(".dat"))
628628
{
629-
if (path.substr(0, 3) == "blk") {
629+
if (path.starts_with("blk")) {
630630
mapBlockFiles[path.substr(3, 5)] = it->path();
631-
} else if (path.substr(0, 3) == "rev") {
631+
} else if (path.starts_with("rev")) {
632632
remove(it->path());
633633
}
634634
}

src/qt/test/rpcnestedtests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ void RPCNestedTests::rpcNestedTests()
6464
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock( getblock( getblock(getbestblockhash())[hash] )[hash], true)"); //4 level nesting with whitespace, filtering path and boolean parameter
6565

6666
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo");
67-
QVERIFY(result.substr(0,1) == "{");
67+
QVERIFY(result.starts_with("{"));
6868

6969
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()");
70-
QVERIFY(result.substr(0,1) == "{");
70+
QVERIFY(result.starts_with("{"));
7171

7272
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
73-
QVERIFY(result.substr(0,1) == "{");
73+
QVERIFY(result.starts_with("{"));
7474

7575
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]"); //Quote path identifier are allowed, but look after a child containing the quotes in the key
7676
QVERIFY(result == "null");

src/util/string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ std::vector<T> Split(const std::span<const char>& sp, char sep)
168168

169169
[[nodiscard]] inline std::string_view RemovePrefixView(std::string_view str, std::string_view prefix)
170170
{
171-
if (str.substr(0, prefix.size()) == prefix) {
171+
if (str.starts_with(prefix)) {
172172
return str.substr(prefix.size());
173173
}
174174
return str;

0 commit comments

Comments
 (0)