Fix/suppress cmds/lshal google-explicit-constructor warnings
* Add explicit to conversion constructors/operators * Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters Bug: 28341362 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor Change-Id: I67a59b0051b5550ea135a91664bf03995e94eb75
This commit is contained in:
parent
a7fa269dda
commit
45e31c739f
9 changed files with 14 additions and 14 deletions
|
@ -27,7 +27,7 @@ class Lshal;
|
|||
// Base class for all *Commands
|
||||
class Command {
|
||||
public:
|
||||
Command(Lshal& lshal) : mLshal(lshal) {}
|
||||
explicit Command(Lshal& lshal) : mLshal(lshal) {}
|
||||
virtual ~Command() = default;
|
||||
// Expect optind to be set by Lshal::main and points to the next argument
|
||||
// to process.
|
||||
|
|
|
@ -31,7 +31,7 @@ class Lshal;
|
|||
|
||||
class DebugCommand : public Command {
|
||||
public:
|
||||
DebugCommand(Lshal &lshal) : Command(lshal) {}
|
||||
explicit DebugCommand(Lshal &lshal) : Command(lshal) {}
|
||||
~DebugCommand() = default;
|
||||
Status main(const Arg &arg) override;
|
||||
void usage() const override;
|
||||
|
|
|
@ -31,7 +31,7 @@ class Lshal;
|
|||
|
||||
class HelpCommand : public Command {
|
||||
public:
|
||||
HelpCommand(Lshal &lshal) : Command(lshal) {}
|
||||
explicit HelpCommand(Lshal &lshal) : Command(lshal) {}
|
||||
~HelpCommand() = default;
|
||||
Status main(const Arg &arg) override;
|
||||
void usage() const override;
|
||||
|
|
|
@ -57,7 +57,7 @@ enum class HalType {
|
|||
|
||||
class ListCommand : public Command {
|
||||
public:
|
||||
ListCommand(Lshal &lshal) : Command(lshal) {}
|
||||
explicit ListCommand(Lshal &lshal) : Command(lshal) {}
|
||||
virtual ~ListCommand() = default;
|
||||
Status main(const Arg &arg) override;
|
||||
void usage() const override;
|
||||
|
|
|
@ -25,8 +25,8 @@ namespace lshal {
|
|||
template<typename S>
|
||||
class NullableOStream {
|
||||
public:
|
||||
NullableOStream(S &os) : mOs(&os) {}
|
||||
NullableOStream(S *os) : mOs(os) {}
|
||||
explicit NullableOStream(S &os) : mOs(&os) {}
|
||||
explicit NullableOStream(S *os) : mOs(os) {}
|
||||
NullableOStream &operator=(S &os) {
|
||||
mOs = &os;
|
||||
return *this;
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
S& buf() const {
|
||||
return *mOs;
|
||||
}
|
||||
operator bool() const {
|
||||
operator bool() const { // NOLINT(google-explicit-constructor)
|
||||
return mOs != nullptr;
|
||||
}
|
||||
private:
|
||||
|
|
|
@ -149,7 +149,7 @@ using TableEntryCompare = std::function<bool(const TableEntry &, const TableEntr
|
|||
|
||||
class MergedTable {
|
||||
public:
|
||||
MergedTable(std::vector<const Table*>&& tables) : mTables(std::move(tables)) {}
|
||||
explicit MergedTable(std::vector<const Table*>&& tables) : mTables(std::move(tables)) {}
|
||||
TextTable createTextTable();
|
||||
private:
|
||||
std::vector<const Table*> mTables;
|
||||
|
|
|
@ -33,11 +33,11 @@ public:
|
|||
TextTableRow() {}
|
||||
|
||||
// A row of cells.
|
||||
TextTableRow(std::vector<std::string>&& v) : mFields(std::move(v)) {}
|
||||
explicit TextTableRow(std::vector<std::string>&& v) : mFields(std::move(v)) {}
|
||||
|
||||
// A single comment string.
|
||||
TextTableRow(std::string&& s) : mLine(std::move(s)) {}
|
||||
TextTableRow(const std::string& s) : mLine(s) {}
|
||||
explicit TextTableRow(std::string&& s) : mLine(std::move(s)) {}
|
||||
explicit TextTableRow(const std::string& s) : mLine(s) {}
|
||||
|
||||
// Whether this row is an actual row of cells.
|
||||
bool isRow() const { return !fields().empty(); }
|
||||
|
|
|
@ -29,7 +29,7 @@ static constexpr std::chrono::milliseconds IPC_CALL_WAIT{500};
|
|||
|
||||
class BackgroundTaskState {
|
||||
public:
|
||||
BackgroundTaskState(std::function<void(void)> &&func)
|
||||
explicit BackgroundTaskState(std::function<void(void)> &&func)
|
||||
: mFunc(std::forward<decltype(func)>(func)) {}
|
||||
void notify() {
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
|
|
|
@ -191,7 +191,7 @@ public:
|
|||
// expose protected fields and methods for ListCommand
|
||||
class MockListCommand : public ListCommand {
|
||||
public:
|
||||
MockListCommand(Lshal* lshal) : ListCommand(*lshal) {}
|
||||
explicit MockListCommand(Lshal* lshal) : ListCommand(*lshal) {}
|
||||
|
||||
Status parseArgs(const Arg& arg) { return ListCommand::parseArgs(arg); }
|
||||
Status main(const Arg& arg) { return ListCommand::main(arg); }
|
||||
|
@ -308,7 +308,7 @@ static hidl_hash getHashFromId(pid_t serverId) {
|
|||
// Fake service returned by mocked IServiceManager::get.
|
||||
class TestService : public IBase {
|
||||
public:
|
||||
TestService(pid_t id) : mId(id) {}
|
||||
explicit TestService(pid_t id) : mId(id) {}
|
||||
hardware::Return<void> getDebugInfo(getDebugInfo_cb cb) override {
|
||||
cb({ mId /* pid */, getPtr(mId), DebugInfo::Architecture::IS_64BIT });
|
||||
return hardware::Void();
|
||||
|
|
Loading…
Reference in a new issue