mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8568 from aarlt/clang-tidy-apply-modernize-use-override
clang-tidy: Apply modernize-use-override.
This commit is contained in:
commit
806c835647
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
@ -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;
|
||||
|
@ -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) {}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<YulString, size_t> countReferences(Block const& _block, CountWhat _countWhat = VariablesAndFunctions);
|
||||
static std::map<YulString, size_t> countReferences(FunctionDefinition const& _function, CountWhat _countWhat = VariablesAndFunctions);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -34,14 +34,14 @@ namespace solidity::frontend::test
|
||||
class SMTCheckerFramework: public AnalysisFramework
|
||||
{
|
||||
protected:
|
||||
virtual std::pair<SourceUnit const*, ErrorList>
|
||||
std::pair<SourceUnit const*, ErrorList>
|
||||
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,
|
||||
|
@ -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 = "",
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
return std::make_unique<SyntaxTest>(_config.filename, _config.evmVersion);
|
||||
}
|
||||
SyntaxTest(std::string const& _filename, langutil::EVMVersion _evmVersion);
|
||||
virtual ~SyntaxTest() {}
|
||||
~SyntaxTest() override {}
|
||||
protected:
|
||||
void parseAndAnalyze() override;
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user