mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 11:13:23 -03:00
bitcoin-tidy: Apply bitcoin-unterminated-logprintf to spkm as well
This commit is contained in:
parent
faa11434fe
commit
fa60fa3b0c
2 changed files with 18 additions and 2 deletions
|
@ -43,6 +43,20 @@ public:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ScriptPubKeyMan
|
||||||
|
{
|
||||||
|
std::string GetDisplayName() const
|
||||||
|
{
|
||||||
|
return "default wallet";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... Params>
|
||||||
|
void WalletLogPrintf(const char* fmt, Params... parameters) const
|
||||||
|
{
|
||||||
|
LogPrintf(("%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
void good_func()
|
void good_func()
|
||||||
{
|
{
|
||||||
LogPrintf("hello world!\n");
|
LogPrintf("hello world!\n");
|
||||||
|
@ -51,6 +65,8 @@ void good_func2()
|
||||||
{
|
{
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
wallet.WalletLogPrintf("hi\n");
|
wallet.WalletLogPrintf("hi\n");
|
||||||
|
ScriptPubKeyMan spkm;
|
||||||
|
spkm.WalletLogPrintf("hi\n");
|
||||||
|
|
||||||
const CWallet& walletref = wallet;
|
const CWallet& walletref = wallet;
|
||||||
walletref.WalletLogPrintf("hi\n");
|
walletref.WalletLogPrintf("hi\n");
|
||||||
|
@ -80,6 +96,8 @@ void bad_func5()
|
||||||
{
|
{
|
||||||
CWallet wallet;
|
CWallet wallet;
|
||||||
wallet.WalletLogPrintf("hi");
|
wallet.WalletLogPrintf("hi");
|
||||||
|
ScriptPubKeyMan spkm;
|
||||||
|
spkm.WalletLogPrintf("hi");
|
||||||
|
|
||||||
const CWallet& walletref = wallet;
|
const CWallet& walletref = wallet;
|
||||||
walletref.WalletLogPrintf("hi");
|
walletref.WalletLogPrintf("hi");
|
||||||
|
|
|
@ -36,14 +36,12 @@ void LogPrintfCheck::registerMatchers(clang::ast_matchers::MatchFinder* finder)
|
||||||
this);
|
this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CWallet wallet;
|
|
||||||
auto walletptr = &wallet;
|
auto walletptr = &wallet;
|
||||||
wallet.WalletLogPrintf("foo");
|
wallet.WalletLogPrintf("foo");
|
||||||
wallet->WalletLogPrintf("foo");
|
wallet->WalletLogPrintf("foo");
|
||||||
*/
|
*/
|
||||||
finder->addMatcher(
|
finder->addMatcher(
|
||||||
cxxMemberCallExpr(
|
cxxMemberCallExpr(
|
||||||
thisPointerType(qualType(hasDeclaration(cxxRecordDecl(hasName("CWallet"))))),
|
|
||||||
callee(cxxMethodDecl(hasName("WalletLogPrintf"))),
|
callee(cxxMethodDecl(hasName("WalletLogPrintf"))),
|
||||||
hasArgument(0, stringLiteral(unterminated()).bind("logstring"))),
|
hasArgument(0, stringLiteral(unterminated()).bind("logstring"))),
|
||||||
this);
|
this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue