Merge bitcoin/bitcoin#32226: ci: switch to LLVM 20 in tidy job
Some checks are pending
CI / test each commit (push) Waiting to run
CI / macOS 14 native, arm64, no depends, sqlite only, gui (push) Waiting to run
CI / macOS 14 native, arm64, fuzz (push) Waiting to run
CI / Windows native, VS 2022 (push) Waiting to run
CI / Windows native, fuzz, VS 2022 (push) Waiting to run
CI / Linux->Windows cross, no tests (push) Waiting to run
CI / Windows, test cross-built (push) Blocked by required conditions
CI / ASan + LSan + UBSan + integer, no depends, USDT (push) Waiting to run

08aa7fe232 ci: clang-tidy 20 (fanquake)
2b85d31bcc 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 08aa7fe232
  hebasto:
    ACK 08aa7fe232.

Tree-SHA512: 54b6c64adcf7556edf3b30f87935de7868354e8ad252da834796f347a5a77feda01f145f17e5a7419cf6f3b4f87fc2b168c1ec2a2d13bb4e0ffcc0fac667fd42
This commit is contained in:
Hennadii Stepanov 2025-04-23 13:35:38 +01:00
commit 9a4c92eb9a
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
12 changed files with 17 additions and 17 deletions

View file

@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
export CONTAINER_NAME=ci_native_tidy
export TIDY_LLVM_V="19"
export TIDY_LLVM_V="20"
export APT_LLVM_V="${TIDY_LLVM_V}"
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"
export NO_DEPENDS=1

View file

@ -1220,7 +1220,7 @@ static int CommandLineRPC(int argc, char *argv[])
if (gArgs.GetBoolArg("-stdinwalletpassphrase", false)) {
NO_STDIN_ECHO();
std::string walletPass;
if (args.size() < 1 || args[0].substr(0, 16) != "walletpassphrase") {
if (args.size() < 1 || !args[0].starts_with("walletpassphrase")) {
throw std::runtime_error("-stdinwalletpassphrase is only applicable for walletpassphrase(change)");
}
if (!StdinReady()) {

View file

@ -85,7 +85,7 @@ KeyInfo InterpretKey(std::string key)
result.section = key.substr(0, option_index);
key.erase(0, option_index + 1);
}
if (key.substr(0, 2) == "no") {
if (key.starts_with("no")) {
key.erase(0, 2);
result.negated = true;
}
@ -189,7 +189,7 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
// internet" warning, and clicks the Open button, macOS passes
// a unique process serial number (PSN) as -psn_... command-line
// argument, which we filter out.
if (key.substr(0, 5) == "-psn_") continue;
if (key.starts_with("-psn_")) continue;
#endif
if (key == "-") break; //bitcoin-tx using stdin

View file

@ -65,7 +65,7 @@ static bool GetConfigOptions(std::istream& stream, const std::string& filepath,
}
} else {
error = strprintf("parse error on line %i: %s", linenr, str);
if (str.size() >= 2 && str.substr(0, 2) == "no") {
if (str.size() >= 2 && str.starts_with("no")) {
error += strprintf(", if you intended to specify a negated option, use %s=1 instead", str);
}
return false;

View file

@ -83,7 +83,7 @@ CScript ParseScript(const std::string& s)
}
result << num.value();
} else if (w.substr(0, 2) == "0x" && w.size() > 2 && IsHex(std::string(w.begin() + 2, w.end()))) {
} else if (w.starts_with("0x") && w.size() > 2 && IsHex(std::string(w.begin() + 2, w.end()))) {
// Raw hex data, inserted NOT pushed onto stack:
std::vector<unsigned char> raw = ParseHex(std::string(w.begin() + 2, w.end()));
result.insert(result.end(), raw.begin(), raw.end());

View file

@ -134,7 +134,7 @@ static bool multiUserAuthorized(std::string strUserPass)
static bool RPCAuthorized(const std::string& strAuth, std::string& strAuthUsernameOut)
{
if (strAuth.substr(0, 6) != "Basic ")
if (!strAuth.starts_with("Basic "))
return false;
std::string_view strUserPass64 = TrimStringView(std::string_view{strAuth}.substr(6));
auto userpass_data = DecodeBase64(strUserPass64);

View file

@ -299,7 +299,7 @@ Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
Reply reply;
// Don't log the full "SESSION CREATE ..." because it contains our private key.
reply.request = request.substr(0, 14) == "SESSION CREATE" ? "SESSION CREATE ..." : request;
reply.request = request.starts_with("SESSION CREATE") ? "SESSION CREATE ..." : request;
// It could take a few minutes for the I2P router to reply as it is querying the I2P network
// (when doing name lookup, for example). Notice: `RecvUntilTerminator()` is checking

View file

@ -624,11 +624,11 @@ void BlockManager::CleanupBlockRevFiles() const
const std::string path = fs::PathToString(it->path().filename());
if (fs::is_regular_file(*it) &&
path.length() == 12 &&
path.substr(8,4) == ".dat")
path.ends_with(".dat"))
{
if (path.substr(0, 3) == "blk") {
if (path.starts_with("blk")) {
mapBlockFiles[path.substr(3, 5)] = it->path();
} else if (path.substr(0, 3) == "rev") {
} else if (path.starts_with("rev")) {
remove(it->path());
}
}

View file

@ -64,13 +64,13 @@ void RPCNestedTests::rpcNestedTests()
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblock( getblock( getblock(getbestblockhash())[hash] )[hash], true)"); //4 level nesting with whitespace, filtering path and boolean parameter
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo");
QVERIFY(result.substr(0,1) == "{");
QVERIFY(result.starts_with("{"));
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()");
QVERIFY(result.substr(0,1) == "{");
QVERIFY(result.starts_with("{"));
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo "); //whitespace at the end will be tolerated
QVERIFY(result.substr(0,1) == "{");
QVERIFY(result.starts_with("{"));
RPCConsole::RPCExecuteCommandLine(m_node, result, "getblockchaininfo()[\"chain\"]"); //Quote path identifier are allowed, but look after a child containing the quotes in the key
QVERIFY(result == "null");

View file

@ -168,7 +168,7 @@ std::vector<T> Split(const std::span<const char>& sp, char sep)
[[nodiscard]] inline std::string_view RemovePrefixView(std::string_view str, std::string_view prefix)
{
if (str.substr(0, prefix.size()) == prefix) {
if (str.starts_with(prefix)) {
return str.substr(prefix.size());
}
return str;

View file

@ -559,7 +559,7 @@ RPCHelpMan importwallet()
fLabel = false;
if (vstr[nStr] == "reserve=1")
fLabel = false;
if (vstr[nStr].substr(0,6) == "label=") {
if (vstr[nStr].starts_with("label=")) {
strLabel = DecodeDumpString(vstr[nStr].substr(6));
fLabel = true;
}

View file

@ -58,7 +58,7 @@ std::unique_ptr<CZMQNotificationInterface> CZMQNotificationInterface::Create(std
const auto& factory = entry.second;
for (std::string& address : gArgs.GetArgs(arg)) {
// libzmq uses prefix "ipc://" for UNIX domain sockets
if (address.substr(0, ADDR_PREFIX_UNIX.length()) == ADDR_PREFIX_UNIX) {
if (address.starts_with(ADDR_PREFIX_UNIX)) {
address.replace(0, ADDR_PREFIX_UNIX.length(), ADDR_PREFIX_IPC);
}