mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
clang-tidy: bugprone-virtual-near-miss
A few virtual functions are called by constructors or destructors, which is dangerous in C++ (as an overridden virtual impl won't be called, only the one in the current class). Fix by either marking the function final or not calling at all (if possible).
This commit is contained in:
@@ -83,7 +83,7 @@ class ParallelCommandGroup
|
||||
bool RunsWhenDisabled() const override;
|
||||
|
||||
private:
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
|
||||
|
||||
std::vector<std::pair<std::unique_ptr<Command>, bool>> m_commands;
|
||||
bool m_runWhenDisabled{true};
|
||||
|
||||
@@ -91,7 +91,7 @@ class ParallelDeadlineGroup
|
||||
bool RunsWhenDisabled() const override;
|
||||
|
||||
private:
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
|
||||
|
||||
void SetDeadline(std::unique_ptr<Command>&& deadline);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class ParallelRaceGroup
|
||||
bool RunsWhenDisabled() const override;
|
||||
|
||||
private:
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
|
||||
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
|
||||
|
||||
std::vector<std::unique_ptr<Command>> m_commands;
|
||||
bool m_runWhenDisabled{true};
|
||||
|
||||
Reference in New Issue
Block a user