diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-04-11 02:11:45 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-04-11 02:11:45 +0000 |
commit | c16fc548515f2fd01bc2cbe4befd822a636cc154 (patch) | |
tree | 5e13c4e43ed33c96f7f8043a561318ef458ab5e1 /examples | |
parent | 2c64a1129f14d6322631e1c6d610b92c4c4871d0 (diff) |
Use 'override/final' instead of 'virtual' for overridden methods
The patch is generated using clang-tidy misc-use-override check.
This command was used:
tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
-checks='-*,misc-use-override' -header-filter='llvm|clang' \
-j=32 -fix -format
http://reviews.llvm.org/D8925
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ExceptionDemo/ExceptionDemo.cpp | 2 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter3/toy.cpp | 8 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter4/toy.cpp | 12 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter5/toy.cpp | 12 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter6/toy.cpp | 14 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter7/toy.cpp | 16 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter8/toy.cpp | 32 |
7 files changed, 48 insertions, 48 deletions
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp index d68c05f1222..fed42b7c2bc 100644 --- a/examples/ExceptionDemo/ExceptionDemo.cpp +++ b/examples/ExceptionDemo/ExceptionDemo.cpp @@ -1573,7 +1573,7 @@ public: std::runtime_error::operator=(toCopy))); } - virtual ~OurCppRunException (void) throw () {} + ~OurCppRunException(void) throw() override {} }; } // end anonymous namespace diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp index 04a1e1ad70f..c60f76725fd 100644 --- a/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/examples/Kaleidoscope/Chapter3/toy.cpp @@ -93,7 +93,7 @@ class NumberExprAST : public ExprAST { double Val; public: NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -101,7 +101,7 @@ class VariableExprAST : public ExprAST { std::string Name; public: VariableExprAST(const std::string &name) : Name(name) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -111,7 +111,7 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -121,7 +121,7 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector<ExprAST*> &args) : Callee(callee), Args(args) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp index 329c3bed3eb..ad091e4496b 100644 --- a/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/examples/Kaleidoscope/Chapter4/toy.cpp @@ -107,7 +107,7 @@ class NumberExprAST : public ExprAST { public: NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -116,7 +116,7 @@ class VariableExprAST : public ExprAST { public: VariableExprAST(const std::string &name) : Name(name) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -127,7 +127,7 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -138,7 +138,7 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector<ExprAST *> &args) : Callee(callee), Args(args) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, @@ -452,13 +452,13 @@ class HelpingMemoryManager : public SectionMemoryManager { public: HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {} - virtual ~HelpingMemoryManager() {} + ~HelpingMemoryManager() override {} /// This method returns the address of the specified symbol. /// Our implementation will attempt to find symbols in other /// modules associated with the MCJITHelper to cross link symbols /// from one generated module to another. - virtual uint64_t getSymbolAddress(const std::string &Name) override; + uint64_t getSymbolAddress(const std::string &Name) override; private: MCJITHelper *MasterHelper; diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp index 8ebc2bc12b2..db990489573 100644 --- a/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/examples/Kaleidoscope/Chapter5/toy.cpp @@ -125,7 +125,7 @@ class NumberExprAST : public ExprAST { public: NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -134,7 +134,7 @@ class VariableExprAST : public ExprAST { public: VariableExprAST(const std::string &name) : Name(name) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -145,7 +145,7 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -156,7 +156,7 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector<ExprAST *> &args) : Callee(callee), Args(args) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// IfExprAST - Expression class for if/then/else. @@ -166,7 +166,7 @@ class IfExprAST : public ExprAST { public: IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) : Cond(cond), Then(then), Else(_else) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// ForExprAST - Expression class for for/in. @@ -178,7 +178,7 @@ public: ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, ExprAST *step, ExprAST *body) : VarName(varname), Start(start), End(end), Step(step), Body(body) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp index eb7e8e1f982..e978a3ea368 100644 --- a/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/examples/Kaleidoscope/Chapter6/toy.cpp @@ -133,7 +133,7 @@ class NumberExprAST : public ExprAST { public: NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -142,7 +142,7 @@ class VariableExprAST : public ExprAST { public: VariableExprAST(const std::string &name) : Name(name) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// UnaryExprAST - Expression class for a unary operator. @@ -153,7 +153,7 @@ class UnaryExprAST : public ExprAST { public: UnaryExprAST(char opcode, ExprAST *operand) : Opcode(opcode), Operand(operand) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -164,7 +164,7 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -175,7 +175,7 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector<ExprAST *> &args) : Callee(callee), Args(args) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// IfExprAST - Expression class for if/then/else. @@ -185,7 +185,7 @@ class IfExprAST : public ExprAST { public: IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) : Cond(cond), Then(then), Else(_else) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// ForExprAST - Expression class for for/in. @@ -197,7 +197,7 @@ public: ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, ExprAST *step, ExprAST *body) : VarName(varname), Start(start), End(end), Step(step), Body(body) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp index ce5e1ddceb1..53ea51c2b9c 100644 --- a/examples/Kaleidoscope/Chapter7/toy.cpp +++ b/examples/Kaleidoscope/Chapter7/toy.cpp @@ -138,7 +138,7 @@ class NumberExprAST : public ExprAST { public: NumberExprAST(double val) : Val(val) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -148,7 +148,7 @@ class VariableExprAST : public ExprAST { public: VariableExprAST(const std::string &name) : Name(name) {} const std::string &getName() const { return Name; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// UnaryExprAST - Expression class for a unary operator. @@ -159,7 +159,7 @@ class UnaryExprAST : public ExprAST { public: UnaryExprAST(char opcode, ExprAST *operand) : Opcode(opcode), Operand(operand) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -170,7 +170,7 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs) : Op(op), LHS(lhs), RHS(rhs) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -181,7 +181,7 @@ class CallExprAST : public ExprAST { public: CallExprAST(const std::string &callee, std::vector<ExprAST *> &args) : Callee(callee), Args(args) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// IfExprAST - Expression class for if/then/else. @@ -191,7 +191,7 @@ class IfExprAST : public ExprAST { public: IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else) : Cond(cond), Then(then), Else(_else) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// ForExprAST - Expression class for for/in. @@ -203,7 +203,7 @@ public: ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, ExprAST *step, ExprAST *body) : VarName(varname), Start(start), End(end), Step(step), Body(body) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// VarExprAST - Expression class for var/in @@ -216,7 +216,7 @@ public: ExprAST *body) : VarNames(varnames), Body(body) {} - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, diff --git a/examples/Kaleidoscope/Chapter8/toy.cpp b/examples/Kaleidoscope/Chapter8/toy.cpp index 39b6a654150..2838d6df593 100644 --- a/examples/Kaleidoscope/Chapter8/toy.cpp +++ b/examples/Kaleidoscope/Chapter8/toy.cpp @@ -221,10 +221,10 @@ class NumberExprAST : public ExprAST { public: NumberExprAST(double val) : Val(val) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { return ExprAST::dump(out << Val, ind); } - virtual Value *Codegen(); + Value *Codegen() override; }; /// VariableExprAST - Expression class for referencing a variable, like "a". @@ -235,10 +235,10 @@ public: VariableExprAST(SourceLocation Loc, const std::string &name) : ExprAST(Loc), Name(name) {} const std::string &getName() const { return Name; } - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { return ExprAST::dump(out << Name, ind); } - virtual Value *Codegen(); + Value *Codegen() override; }; /// UnaryExprAST - Expression class for a unary operator. @@ -249,12 +249,12 @@ class UnaryExprAST : public ExprAST { public: UnaryExprAST(char opcode, ExprAST *operand) : Opcode(opcode), Operand(operand) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "unary" << Opcode, ind); Operand->dump(out, ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// BinaryExprAST - Expression class for a binary operator. @@ -265,13 +265,13 @@ class BinaryExprAST : public ExprAST { public: BinaryExprAST(SourceLocation Loc, char op, ExprAST *lhs, ExprAST *rhs) : ExprAST(Loc), Op(op), LHS(lhs), RHS(rhs) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "binary" << Op, ind); LHS->dump(indent(out, ind) << "LHS:", ind + 1); RHS->dump(indent(out, ind) << "RHS:", ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// CallExprAST - Expression class for function calls. @@ -283,13 +283,13 @@ public: CallExprAST(SourceLocation Loc, const std::string &callee, std::vector<ExprAST *> &args) : ExprAST(Loc), Callee(callee), Args(args) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "call " << Callee, ind); for (ExprAST *Arg : Args) Arg->dump(indent(out, ind + 1), ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// IfExprAST - Expression class for if/then/else. @@ -299,14 +299,14 @@ class IfExprAST : public ExprAST { public: IfExprAST(SourceLocation Loc, ExprAST *cond, ExprAST *then, ExprAST *_else) : ExprAST(Loc), Cond(cond), Then(then), Else(_else) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "if", ind); Cond->dump(indent(out, ind) << "Cond:", ind + 1); Then->dump(indent(out, ind) << "Then:", ind + 1); Else->dump(indent(out, ind) << "Else:", ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// ForExprAST - Expression class for for/in. @@ -318,7 +318,7 @@ public: ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end, ExprAST *step, ExprAST *body) : VarName(varname), Start(start), End(end), Step(step), Body(body) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "for", ind); Start->dump(indent(out, ind) << "Cond:", ind + 1); End->dump(indent(out, ind) << "End:", ind + 1); @@ -326,7 +326,7 @@ public: Body->dump(indent(out, ind) << "Body:", ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// VarExprAST - Expression class for var/in @@ -339,14 +339,14 @@ public: ExprAST *body) : VarNames(varnames), Body(body) {} - virtual std::ostream &dump(std::ostream &out, int ind) { + std::ostream &dump(std::ostream &out, int ind) override { ExprAST::dump(out << "var", ind); for (const auto &NamedVar : VarNames) NamedVar.second->dump(indent(out, ind) << NamedVar.first << ':', ind + 1); Body->dump(indent(out, ind) << "Body:", ind + 1); return out; } - virtual Value *Codegen(); + Value *Codegen() override; }; /// PrototypeAST - This class represents the "prototype" for a function, |