diff --git a/libsolidity/analysis/ConstantEvaluator.h b/libsolidity/analysis/ConstantEvaluator.h index 0f2dd558e..e92113bb8 100644 --- a/libsolidity/analysis/ConstantEvaluator.h +++ b/libsolidity/analysis/ConstantEvaluator.h @@ -54,11 +54,11 @@ public: TypePointer evaluate(Expression const& _expr); private: - virtual void endVisit(BinaryOperation const& _operation); - virtual void endVisit(UnaryOperation const& _operation); - virtual void endVisit(Literal const& _literal); - virtual void endVisit(Identifier const& _identifier); - virtual void endVisit(TupleExpression const& _tuple); + void endVisit(BinaryOperation const& _operation) override; + void endVisit(UnaryOperation const& _operation) override; + void endVisit(Literal const& _literal) override; + void endVisit(Identifier const& _identifier) override; + void endVisit(TupleExpression const& _tuple) override; void setType(ASTNode const& _node, TypePointer const& _type); TypePointer type(ASTNode const& _node); diff --git a/libsolidity/analysis/StaticAnalyzer.h b/libsolidity/analysis/StaticAnalyzer.h index f3ed30b20..57ac54fb1 100644 --- a/libsolidity/analysis/StaticAnalyzer.h +++ b/libsolidity/analysis/StaticAnalyzer.h @@ -50,7 +50,7 @@ class StaticAnalyzer: private ASTConstVisitor public: /// @param _errorReporter provides the error logging functionality. explicit StaticAnalyzer(langutil::ErrorReporter& _errorReporter); - ~StaticAnalyzer(); + ~StaticAnalyzer() override; /// 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 diff --git a/libyul/backends/evm/EVMAssembly.h b/libyul/backends/evm/EVMAssembly.h index e4ba4979a..744d8738b 100644 --- a/libyul/backends/evm/EVMAssembly.h +++ b/libyul/backends/evm/EVMAssembly.h @@ -38,7 +38,7 @@ class EVMAssembly: public AbstractAssembly { public: 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. void setSourceLocation(langutil::SourceLocation const& _location) override; diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index fb4bc38e1..eae870815 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -92,10 +92,10 @@ public: {} public: - void operator()(Identifier const& _identifier); - void operator()(FunctionDefinition const&); - void operator()(ForLoop const&); - void operator()(Block const& _block); + void operator()(Identifier const& _identifier) override; + void operator()(FunctionDefinition const&) override; + void operator()(ForLoop const&) override; + void operator()(Block const& _block) override; private: void increaseRefIfFound(YulString _variableName); diff --git a/libyul/backends/evm/NoOutputAssembly.h b/libyul/backends/evm/NoOutputAssembly.h index bc914f9ac..d72f9ea66 100644 --- a/libyul/backends/evm/NoOutputAssembly.h +++ b/libyul/backends/evm/NoOutputAssembly.h @@ -45,7 +45,7 @@ class NoOutputAssembly: public AbstractAssembly { public: explicit NoOutputAssembly(bool _evm15 = false): m_evm15(_evm15) { } - virtual ~NoOutputAssembly() = default; + ~NoOutputAssembly() override = default; void setSourceLocation(langutil::SourceLocation const&) override {} int stackHeight() const override { return m_stackHeight; } diff --git a/libyul/optimiser/ASTCopier.h b/libyul/optimiser/ASTCopier.h index 0ac0b5f82..3a05d2ca3 100644 --- a/libyul/optimiser/ASTCopier.h +++ b/libyul/optimiser/ASTCopier.h @@ -65,7 +65,7 @@ public: class ASTCopier: public ExpressionCopier, public StatementCopier { public: - virtual ~ASTCopier() = default; + ~ASTCopier() override = default; Expression operator()(Literal const& _literal) override; Expression operator()(Identifier const& _identifier) override; Expression operator()(FunctionCall const&) override; diff --git a/libyul/optimiser/ExpressionSimplifier.h b/libyul/optimiser/ExpressionSimplifier.h index c11ab9bf3..ce83b4e1e 100644 --- a/libyul/optimiser/ExpressionSimplifier.h +++ b/libyul/optimiser/ExpressionSimplifier.h @@ -46,7 +46,7 @@ public: static void run(OptimiserStepContext&, Block& _ast); using ASTModifier::operator(); - virtual void visit(Expression& _expression); + void visit(Expression& _expression) override; private: explicit ExpressionSimplifier(Dialect const& _dialect): DataFlowAnalyzer(_dialect) {} diff --git a/libyul/optimiser/FunctionHoister.h b/libyul/optimiser/FunctionHoister.h index 2a88e1acf..7106c03a4 100644 --- a/libyul/optimiser/FunctionHoister.h +++ b/libyul/optimiser/FunctionHoister.h @@ -42,7 +42,7 @@ public: static void run(OptimiserStepContext&, Block& _ast) { FunctionHoister{}(_ast); } using ASTModifier::operator(); - virtual void operator()(Block& _block); + void operator()(Block& _block) override; private: FunctionHoister() = default; diff --git a/libyul/optimiser/NameCollector.cpp b/libyul/optimiser/NameCollector.cpp index 33a5b624a..f9bb40bf4 100644 --- a/libyul/optimiser/NameCollector.cpp +++ b/libyul/optimiser/NameCollector.cpp @@ -36,9 +36,9 @@ void NameCollector::operator()(VariableDeclaration const& _varDecl) void NameCollector::operator ()(FunctionDefinition const& _funDef) { m_names.emplace(_funDef.name); - for (auto const arg: _funDef.parameters) + for (auto const& arg: _funDef.parameters) m_names.emplace(arg.name); - for (auto const ret: _funDef.returnVariables) + for (auto const& ret: _funDef.returnVariables) m_names.emplace(ret.name); ASTWalker::operator ()(_funDef); } diff --git a/libyul/optimiser/NameCollector.h b/libyul/optimiser/NameCollector.h index 97fbd27c6..a48aa1a3b 100644 --- a/libyul/optimiser/NameCollector.h +++ b/libyul/optimiser/NameCollector.h @@ -61,8 +61,8 @@ public: {} using ASTWalker::operator (); - virtual void operator()(Identifier const& _identifier); - virtual void operator()(FunctionCall const& _funCall); + void operator()(Identifier const& _identifier) override; + void operator()(FunctionCall const& _funCall) override; static std::map countReferences(Block const& _block, CountWhat _countWhat = VariablesAndFunctions); static std::map countReferences(FunctionDefinition const& _function, CountWhat _countWhat = VariablesAndFunctions); diff --git a/libyul/optimiser/Semantics.h b/libyul/optimiser/Semantics.h index 4efc83247..46d2984ca 100644 --- a/libyul/optimiser/Semantics.h +++ b/libyul/optimiser/Semantics.h @@ -104,7 +104,7 @@ public: static bool containsMSize(Dialect const& _dialect, Block const& _ast); using ASTWalker::operator(); - void operator()(FunctionCall const& _funCall); + void operator()(FunctionCall const& _funCall) override; private: MSizeFinder(Dialect const& _dialect): m_dialect(_dialect) {} @@ -129,7 +129,7 @@ public: } using ASTWalker::operator(); - void operator()(Leave const&) { m_leaveFound = true; } + void operator()(Leave const&) override { m_leaveFound = true; } private: LeaveFinder() = default; diff --git a/libyul/optimiser/TypeInfo.cpp b/libyul/optimiser/TypeInfo.cpp index ea2d81a83..adb6e1cce 100644 --- a/libyul/optimiser/TypeInfo.cpp +++ b/libyul/optimiser/TypeInfo.cpp @@ -50,12 +50,12 @@ public: ASTWalker::operator()(_funDef); auto& funType = functionTypes[_funDef.name]; - for (auto const arg: _funDef.parameters) + for (auto const& arg: _funDef.parameters) { funType.parameters.emplace_back(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); variableTypes[ret.name] = ret.type; diff --git a/test/libsolidity/SMTChecker.cpp b/test/libsolidity/SMTChecker.cpp index 06862ad08..6df19c1c7 100644 --- a/test/libsolidity/SMTChecker.cpp +++ b/test/libsolidity/SMTChecker.cpp @@ -34,14 +34,14 @@ namespace solidity::frontend::test class SMTCheckerFramework: public AnalysisFramework { protected: - virtual std::pair + std::pair parseAnalyseAndReturnError( std::string const& _source, bool _reportWarnings = false, bool _insertVersionPragma = true, bool _allowMultipleErrors = false, bool _allowRecoveryErrors = false - ) + ) override { return AnalysisFramework::parseAnalyseAndReturnError( "pragma experimental SMTChecker;\n" + _source, diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index aaa17525f..2410195fa 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -46,7 +46,7 @@ public: ExecutionFramework(_evmVersion), m_showMetadata(solidity::test::CommonOptions::get().showMetadata) {} - virtual bytes const& compileAndRunWithoutCheck( + bytes const& compileAndRunWithoutCheck( std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "", diff --git a/test/libsolidity/SolidityExpressionCompiler.cpp b/test/libsolidity/SolidityExpressionCompiler.cpp index cdaee104b..5dfefc0b7 100644 --- a/test/libsolidity/SolidityExpressionCompiler.cpp +++ b/test/libsolidity/SolidityExpressionCompiler.cpp @@ -52,15 +52,15 @@ public: FirstExpressionExtractor(ASTNode& _node): m_expression(nullptr) { _node.accept(*this); } Expression* expression() const { return m_expression; } private: - virtual bool visit(Assignment& _expression) override { return checkExpression(_expression); } - virtual bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); } - virtual bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); } - virtual bool visit(FunctionCall& _expression) override { return checkExpression(_expression); } - virtual bool visit(MemberAccess& _expression) override { return checkExpression(_expression); } - virtual bool visit(IndexAccess& _expression) override { return checkExpression(_expression); } - virtual bool visit(Identifier& _expression) override { return checkExpression(_expression); } - virtual bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); } - virtual bool visit(Literal& _expression) override { return checkExpression(_expression); } + bool visit(Assignment& _expression) override { return checkExpression(_expression); } + bool visit(UnaryOperation& _expression) override { return checkExpression(_expression); } + bool visit(BinaryOperation& _expression) override { return checkExpression(_expression); } + bool visit(FunctionCall& _expression) override { return checkExpression(_expression); } + bool visit(MemberAccess& _expression) override { return checkExpression(_expression); } + bool visit(IndexAccess& _expression) override { return checkExpression(_expression); } + bool visit(Identifier& _expression) override { return checkExpression(_expression); } + bool visit(ElementaryTypeNameExpression& _expression) override { return checkExpression(_expression); } + bool visit(Literal& _expression) override { return checkExpression(_expression); } bool checkExpression(Expression& _expression) { if (m_expression == nullptr) diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 192a26898..12fbc3fce 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(inline_asm_end_location) { public: bool visited = false; - virtual bool visit(InlineAssembly const& _inlineAsm) + bool visit(InlineAssembly const& _inlineAsm) override { auto loc = _inlineAsm.location(); auto asmStr = loc.source->source().substr(loc.start, loc.end - loc.start); diff --git a/test/libyul/SyntaxTest.h b/test/libyul/SyntaxTest.h index b4c838b54..342aa2845 100644 --- a/test/libyul/SyntaxTest.h +++ b/test/libyul/SyntaxTest.h @@ -37,7 +37,7 @@ public: return std::make_unique(_config.filename, _config.evmVersion); } SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion); - virtual ~SyntaxTest() {} + ~SyntaxTest() override {} protected: void parseAndAnalyze() override; diff --git a/tools/solidityUpgrade/Upgrade050.h b/tools/solidityUpgrade/Upgrade050.h index d85b69912..58670e7b2 100644 --- a/tools/solidityUpgrade/Upgrade050.h +++ b/tools/solidityUpgrade/Upgrade050.h @@ -37,7 +37,7 @@ public: void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } 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); } private: - void endVisit(frontend::FunctionDefinition const& _function); + void endVisit(frontend::FunctionDefinition const& _function) override; }; } diff --git a/tools/solidityUpgrade/Upgrade060.h b/tools/solidityUpgrade/Upgrade060.h index ea29d3a7b..e2386d104 100644 --- a/tools/solidityUpgrade/Upgrade060.h +++ b/tools/solidityUpgrade/Upgrade060.h @@ -35,7 +35,7 @@ public: void analyze(frontend::SourceUnit const& _sourceUnit) { _sourceUnit.accept(*this); } 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); } 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); } private: - void endVisit(frontend::ContractDefinition const& _function); + void endVisit(frontend::ContractDefinition const& _function) override; }; }