Apply modernize-use-override.

This commit is contained in:
Alexander Arlt 2020-03-31 18:58:22 -05:00
parent 4816484964
commit cae6e7769f
19 changed files with 42 additions and 42 deletions

View File

@ -54,11 +54,11 @@ public:
TypePointer evaluate(Expression const& _expr); TypePointer evaluate(Expression const& _expr);
private: private:
virtual void endVisit(BinaryOperation const& _operation); void endVisit(BinaryOperation const& _operation) override;
virtual void endVisit(UnaryOperation const& _operation); void endVisit(UnaryOperation const& _operation) override;
virtual void endVisit(Literal const& _literal); void endVisit(Literal const& _literal) override;
virtual void endVisit(Identifier const& _identifier); void endVisit(Identifier const& _identifier) override;
virtual void endVisit(TupleExpression const& _tuple); void endVisit(TupleExpression const& _tuple) override;
void setType(ASTNode const& _node, TypePointer const& _type); void setType(ASTNode const& _node, TypePointer const& _type);
TypePointer type(ASTNode const& _node); TypePointer type(ASTNode const& _node);

View File

@ -50,7 +50,7 @@ class StaticAnalyzer: private ASTConstVisitor
public: public:
/// @param _errorReporter provides the error logging functionality. /// @param _errorReporter provides the error logging functionality.
explicit StaticAnalyzer(langutil::ErrorReporter& _errorReporter); explicit StaticAnalyzer(langutil::ErrorReporter& _errorReporter);
~StaticAnalyzer(); ~StaticAnalyzer() override;
/// Performs static analysis on the given source unit and all of its sub-nodes. /// Performs static analysis on the given source unit and all of its sub-nodes.
/// @returns true iff all checks passed. Note even if all checks passed, errors() can still contain warnings /// @returns true iff all checks passed. Note even if all checks passed, errors() can still contain warnings

View File

@ -38,7 +38,7 @@ class EVMAssembly: public AbstractAssembly
{ {
public: public:
explicit EVMAssembly(bool _evm15 = false): m_evm15(_evm15) { } explicit EVMAssembly(bool _evm15 = false): m_evm15(_evm15) { }
virtual ~EVMAssembly() = default; ~EVMAssembly() override = default;
/// Set a new source location valid starting from the next instruction. /// Set a new source location valid starting from the next instruction.
void setSourceLocation(langutil::SourceLocation const& _location) override; void setSourceLocation(langutil::SourceLocation const& _location) override;

View File

@ -92,10 +92,10 @@ public:
{} {}
public: public:
void operator()(Identifier const& _identifier); void operator()(Identifier const& _identifier) override;
void operator()(FunctionDefinition const&); void operator()(FunctionDefinition const&) override;
void operator()(ForLoop const&); void operator()(ForLoop const&) override;
void operator()(Block const& _block); void operator()(Block const& _block) override;
private: private:
void increaseRefIfFound(YulString _variableName); void increaseRefIfFound(YulString _variableName);

View File

@ -45,7 +45,7 @@ class NoOutputAssembly: public AbstractAssembly
{ {
public: public:
explicit NoOutputAssembly(bool _evm15 = false): m_evm15(_evm15) { } explicit NoOutputAssembly(bool _evm15 = false): m_evm15(_evm15) { }
virtual ~NoOutputAssembly() = default; ~NoOutputAssembly() override = default;
void setSourceLocation(langutil::SourceLocation const&) override {} void setSourceLocation(langutil::SourceLocation const&) override {}
int stackHeight() const override { return m_stackHeight; } int stackHeight() const override { return m_stackHeight; }

View File

@ -65,7 +65,7 @@ public:
class ASTCopier: public ExpressionCopier, public StatementCopier class ASTCopier: public ExpressionCopier, public StatementCopier
{ {
public: public:
virtual ~ASTCopier() = default; ~ASTCopier() override = default;
Expression operator()(Literal const& _literal) override; Expression operator()(Literal const& _literal) override;
Expression operator()(Identifier const& _identifier) override; Expression operator()(Identifier const& _identifier) override;
Expression operator()(FunctionCall const&) override; Expression operator()(FunctionCall const&) override;

View File

@ -46,7 +46,7 @@ public:
static void run(OptimiserStepContext&, Block& _ast); static void run(OptimiserStepContext&, Block& _ast);
using ASTModifier::operator(); using ASTModifier::operator();
virtual void visit(Expression& _expression); void visit(Expression& _expression) override;
private: private:
explicit ExpressionSimplifier(Dialect const& _dialect): DataFlowAnalyzer(_dialect) {} explicit ExpressionSimplifier(Dialect const& _dialect): DataFlowAnalyzer(_dialect) {}

View File

@ -42,7 +42,7 @@ public:
static void run(OptimiserStepContext&, Block& _ast) { FunctionHoister{}(_ast); } static void run(OptimiserStepContext&, Block& _ast) { FunctionHoister{}(_ast); }
using ASTModifier::operator(); using ASTModifier::operator();
virtual void operator()(Block& _block); void operator()(Block& _block) override;
private: private:
FunctionHoister() = default; FunctionHoister() = default;

View File

@ -36,9 +36,9 @@ void NameCollector::operator()(VariableDeclaration const& _varDecl)
void NameCollector::operator ()(FunctionDefinition const& _funDef) void NameCollector::operator ()(FunctionDefinition const& _funDef)
{ {
m_names.emplace(_funDef.name); m_names.emplace(_funDef.name);
for (auto const arg: _funDef.parameters) for (auto const& arg: _funDef.parameters)
m_names.emplace(arg.name); m_names.emplace(arg.name);
for (auto const ret: _funDef.returnVariables) for (auto const& ret: _funDef.returnVariables)
m_names.emplace(ret.name); m_names.emplace(ret.name);
ASTWalker::operator ()(_funDef); ASTWalker::operator ()(_funDef);
} }

View File

@ -61,8 +61,8 @@ public:
{} {}
using ASTWalker::operator (); using ASTWalker::operator ();
virtual void operator()(Identifier const& _identifier); void operator()(Identifier const& _identifier) override;
virtual void operator()(FunctionCall const& _funCall); void operator()(FunctionCall const& _funCall) override;
static std::map<YulString, size_t> countReferences(Block const& _block, CountWhat _countWhat = VariablesAndFunctions); static std::map<YulString, size_t> countReferences(Block const& _block, CountWhat _countWhat = VariablesAndFunctions);
static std::map<YulString, size_t> countReferences(FunctionDefinition const& _function, CountWhat _countWhat = VariablesAndFunctions); static std::map<YulString, size_t> countReferences(FunctionDefinition const& _function, CountWhat _countWhat = VariablesAndFunctions);

View File

@ -104,7 +104,7 @@ public:
static bool containsMSize(Dialect const& _dialect, Block const& _ast); static bool containsMSize(Dialect const& _dialect, Block const& _ast);
using ASTWalker::operator(); using ASTWalker::operator();
void operator()(FunctionCall const& _funCall); void operator()(FunctionCall const& _funCall) override;
private: private:
MSizeFinder(Dialect const& _dialect): m_dialect(_dialect) {} MSizeFinder(Dialect const& _dialect): m_dialect(_dialect) {}
@ -129,7 +129,7 @@ public:
} }
using ASTWalker::operator(); using ASTWalker::operator();
void operator()(Leave const&) { m_leaveFound = true; } void operator()(Leave const&) override { m_leaveFound = true; }
private: private:
LeaveFinder() = default; LeaveFinder() = default;

View File

@ -50,12 +50,12 @@ public:
ASTWalker::operator()(_funDef); ASTWalker::operator()(_funDef);
auto& funType = functionTypes[_funDef.name]; auto& funType = functionTypes[_funDef.name];
for (auto const arg: _funDef.parameters) for (auto const& arg: _funDef.parameters)
{ {
funType.parameters.emplace_back(arg.type); funType.parameters.emplace_back(arg.type);
variableTypes[arg.name] = arg.type; variableTypes[arg.name] = arg.type;
} }
for (auto const ret: _funDef.returnVariables) for (auto const& ret: _funDef.returnVariables)
{ {
funType.returns.emplace_back(ret.type); funType.returns.emplace_back(ret.type);
variableTypes[ret.name] = ret.type; variableTypes[ret.name] = ret.type;

View File

@ -34,14 +34,14 @@ namespace solidity::frontend::test
class SMTCheckerFramework: public AnalysisFramework class SMTCheckerFramework: public AnalysisFramework
{ {
protected: protected:
virtual std::pair<SourceUnit const*, ErrorList> std::pair<SourceUnit const*, ErrorList>
parseAnalyseAndReturnError( parseAnalyseAndReturnError(
std::string const& _source, std::string const& _source,
bool _reportWarnings = false, bool _reportWarnings = false,
bool _insertVersionPragma = true, bool _insertVersionPragma = true,
bool _allowMultipleErrors = false, bool _allowMultipleErrors = false,
bool _allowRecoveryErrors = false bool _allowRecoveryErrors = false
) ) override
{ {
return AnalysisFramework::parseAnalyseAndReturnError( return AnalysisFramework::parseAnalyseAndReturnError(
"pragma experimental SMTChecker;\n" + _source, "pragma experimental SMTChecker;\n" + _source,

View File

@ -46,7 +46,7 @@ public:
ExecutionFramework(_evmVersion), m_showMetadata(solidity::test::CommonOptions::get().showMetadata) ExecutionFramework(_evmVersion), m_showMetadata(solidity::test::CommonOptions::get().showMetadata)
{} {}
virtual bytes const& compileAndRunWithoutCheck( bytes const& compileAndRunWithoutCheck(
std::string const& _sourceCode, std::string const& _sourceCode,
u256 const& _value = 0, u256 const& _value = 0,
std::string const& _contractName = "", std::string const& _contractName = "",

View File

@ -52,15 +52,15 @@ public:
FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); } FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); }
Expression* expression() const { return m_expression; } Expression* expression() const { return m_expression; }
private: private:
virtual bool visit(Assignment& _expression) override { return checkExpression(_expression); } bool visit(Assignment& _expression) override { return checkExpression(_expression); }
virtual bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); } bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); }
virtual bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); } bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); }
virtual bool visit(FunctionCall& _expression) override { return checkExpression(_expression); } bool visit(FunctionCall& _expression) override { return checkExpression(_expression); }
virtual bool visit(MemberAccess& _expression) override { return checkExpression(_expression); } bool visit(MemberAccess& _expression) override { return checkExpression(_expression); }
virtual bool visit(IndexAccess& _expression) override { return checkExpression(_expression); } bool visit(IndexAccess& _expression) override { return checkExpression(_expression); }
virtual bool visit(Identifier& _expression) override { return checkExpression(_expression); } bool visit(Identifier& _expression) override { return checkExpression(_expression); }
virtual bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); } bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); }
virtual bool visit(Literal& _expression) override { return checkExpression(_expression); } bool visit(Literal& _expression) override { return checkExpression(_expression); }
bool checkExpression(Expression& _expression) bool checkExpression(Expression& _expression)
{ {
if (m_expression == nullptr) if (m_expression == nullptr)

View File

@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location)
{ {
public: public:
bool visited = false; bool visited = false;
virtual bool visit(InlineAssembly const& _inlineAsm) bool visit(InlineAssembly const& _inlineAsm) override
{ {
auto loc = _inlineAsm.location(); auto loc = _inlineAsm.location();
auto asmStr = loc.source->source().substr(loc.start, loc.end - loc.start); auto asmStr = loc.source->source().substr(loc.start, loc.end - loc.start);

View File

@ -37,7 +37,7 @@ public:
return std::make_unique<SyntaxTest>(_config.filename, _config.evmVersion); return std::make_unique<SyntaxTest>(_config.filename, _config.evmVersion);
} }
SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion); SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion);
virtual ~SyntaxTest() {} ~SyntaxTest() override {}
protected: protected:
void parseAndAnalyze() override; void parseAndAnalyze() override;

View File

@ -37,7 +37,7 @@ public:
void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); }
private: private:
void endVisit(frontend::ContractDefinition const& _contract); void endVisit(frontend::ContractDefinition const& _contract) override;
}; };
/** /**
@ -52,7 +52,7 @@ public:
void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); }
private: private:
void endVisit(frontend::FunctionDefinition const& _function); void endVisit(frontend::FunctionDefinition const& _function) override;
}; };
} }

View File

@ -35,7 +35,7 @@ public:
void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); }
private: private:
void endVisit(frontend::ContractDefinition const& _contract); void endVisit(frontend::ContractDefinition const& _contract) override;
}; };
/** /**
@ -49,7 +49,7 @@ public:
void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); }
private: private:
void endVisit(frontend::ContractDefinition const& _contract); void endVisit(frontend::ContractDefinition const& _contract) override;
}; };
/** /**
@ -63,7 +63,7 @@ public:
void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); }
private: private:
void endVisit(frontend::ContractDefinition const& _function); void endVisit(frontend::ContractDefinition const& _function) override;
}; };
} }