summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-04-11 02:00:23 +0000
committerAlexander Kornienko <alexfh@google.com>2015-04-11 02:00:23 +0000
commit34eb20725d9d923f6f2ff9f205f198d5f3df022b (patch)
tree4edc0a751e1e64c8fd953053d1a230ac09e16eae /clang/unittests/AST
parentaf7d76c7204c0a586fd38fff45ffe0bd284593b0 (diff)
downloadbcm5719-llvm-34eb20725d9d923f6f2ff9f205f198d5f3df022b.tar.gz
bcm5719-llvm-34eb20725d9d923f6f2ff9f205f198d5f3df022b.zip
Use 'override/final' instead of 'virtual' for overridden methods
Summary: 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 Reviewers: dblaikie Reviewed By: dblaikie Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D8926 llvm-svn: 234678
Diffstat (limited to 'clang/unittests/AST')
-rw-r--r--clang/unittests/AST/DeclPrinterTest.cpp2
-rw-r--r--clang/unittests/AST/ExternalASTSourceTest.cpp10
-rw-r--r--clang/unittests/AST/MatchVerifier.h12
-rw-r--r--clang/unittests/AST/NamedDeclPrinterTest.cpp2
-rw-r--r--clang/unittests/AST/SourceLocationTest.cpp10
-rw-r--r--clang/unittests/AST/StmtPrinterTest.cpp2
6 files changed, 20 insertions, 18 deletions
diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index 9f179c4a3f2..070b4daabb8 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -44,7 +44,7 @@ class PrintMatch : public MatchFinder::MatchCallback {
public:
PrintMatch() : NumFoundDecls(0) {}
- virtual void run(const MatchFinder::MatchResult &Result) {
+ void run(const MatchFinder::MatchResult &Result) override {
const Decl *D = Result.Nodes.getDeclAs<Decl>("id");
if (!D || D->isImplicit())
return;
diff --git a/clang/unittests/AST/ExternalASTSourceTest.cpp b/clang/unittests/AST/ExternalASTSourceTest.cpp
index 0cfde74cccc..4f42dcf1033 100644
--- a/clang/unittests/AST/ExternalASTSourceTest.cpp
+++ b/clang/unittests/AST/ExternalASTSourceTest.cpp
@@ -28,15 +28,15 @@ public:
TestFrontendAction(ExternalASTSource *Source) : Source(Source) {}
private:
- virtual void ExecuteAction() {
+ void ExecuteAction() override {
getCompilerInstance().getASTContext().setExternalSource(Source);
getCompilerInstance().getASTContext().getTranslationUnitDecl()
->setHasExternalVisibleStorage();
return ASTFrontendAction::ExecuteAction();
}
- virtual std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+ std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) override {
return llvm::make_unique<ASTConsumer>();
}
@@ -67,8 +67,8 @@ TEST(ExternalASTSourceTest, FailedLookupOccursOnce) {
struct TestSource : ExternalASTSource {
TestSource(unsigned &Calls) : Calls(Calls) {}
- bool FindExternalVisibleDeclsByName(const DeclContext*,
- DeclarationName Name) {
+ bool FindExternalVisibleDeclsByName(const DeclContext *,
+ DeclarationName Name) override {
if (Name.getAsString() == "j")
++Calls;
return false;
diff --git a/clang/unittests/AST/MatchVerifier.h b/clang/unittests/AST/MatchVerifier.h
index e6593913b70..31932479ef8 100644
--- a/clang/unittests/AST/MatchVerifier.h
+++ b/clang/unittests/AST/MatchVerifier.h
@@ -63,7 +63,7 @@ public:
Language L);
protected:
- virtual void run(const MatchFinder::MatchResult &Result);
+ void run(const MatchFinder::MatchResult &Result) override;
virtual void verify(const MatchFinder::MatchResult &Result,
const NodeType &Node) {}
@@ -166,7 +166,8 @@ public:
}
protected:
- void verify(const MatchFinder::MatchResult &Result, const NodeType &Node) {
+ void verify(const MatchFinder::MatchResult &Result,
+ const NodeType &Node) override {
SourceLocation Loc = getLocation(Node);
unsigned Line = Result.SourceManager->getSpellingLineNumber(Loc);
unsigned Column = Result.SourceManager->getSpellingColumnNumber(Loc);
@@ -205,7 +206,8 @@ public:
}
protected:
- void verify(const MatchFinder::MatchResult &Result, const NodeType &Node) {
+ void verify(const MatchFinder::MatchResult &Result,
+ const NodeType &Node) override {
SourceRange R = getRange(Node);
SourceLocation Begin = R.getBegin();
SourceLocation End = R.getEnd();
@@ -244,7 +246,7 @@ public:
protected:
void verify(const MatchFinder::MatchResult &Result,
- const ast_type_traits::DynTypedNode &Node) {
+ const ast_type_traits::DynTypedNode &Node) override {
std::string DumpStr;
llvm::raw_string_ostream Dump(DumpStr);
Node.dump(Dump, *Result.SourceManager);
@@ -271,7 +273,7 @@ public:
protected:
void verify(const MatchFinder::MatchResult &Result,
- const ast_type_traits::DynTypedNode &Node) {
+ const ast_type_traits::DynTypedNode &Node) override {
std::string PrintStr;
llvm::raw_string_ostream Print(PrintStr);
Node.print(Print, Result.Context->getPrintingPolicy());
diff --git a/clang/unittests/AST/NamedDeclPrinterTest.cpp b/clang/unittests/AST/NamedDeclPrinterTest.cpp
index f8fb98454bd..cf97a0abf6c 100644
--- a/clang/unittests/AST/NamedDeclPrinterTest.cpp
+++ b/clang/unittests/AST/NamedDeclPrinterTest.cpp
@@ -37,7 +37,7 @@ public:
explicit PrintMatch(bool suppressUnwrittenScope)
: NumFoundDecls(0), SuppressUnwrittenScope(suppressUnwrittenScope) {}
- virtual void run(const MatchFinder::MatchResult &Result) {
+ void run(const MatchFinder::MatchResult &Result) override {
const NamedDecl *ND = Result.Nodes.getNodeAs<NamedDecl>("id");
if (!ND)
return;
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp
index c1f7b181433..a3fc9530baf 100644
--- a/clang/unittests/AST/SourceLocationTest.cpp
+++ b/clang/unittests/AST/SourceLocationTest.cpp
@@ -60,7 +60,7 @@ TEST(RangeVerifier, WrongRange) {
class LabelDeclRangeVerifier : public RangeVerifier<LabelStmt> {
protected:
- virtual SourceRange getRange(const LabelStmt &Node) {
+ SourceRange getRange(const LabelStmt &Node) override {
return Node.getDecl()->getSourceRange();
}
};
@@ -110,8 +110,8 @@ TEST(MemberExpr, ImplicitMemberRange) {
}
class MemberExprArrowLocVerifier : public RangeVerifier<MemberExpr> {
-protected:
- virtual SourceRange getRange(const MemberExpr &Node) {
+protected:
+ SourceRange getRange(const MemberExpr &Node) override {
return Node.getOperatorLoc();
}
};
@@ -201,7 +201,7 @@ TEST(InitListExpr, VectorLiteralInitListParens) {
class TemplateAngleBracketLocRangeVerifier : public RangeVerifier<TypeLoc> {
protected:
- virtual SourceRange getRange(const TypeLoc &Node) {
+ SourceRange getRange(const TypeLoc &Node) override {
TemplateSpecializationTypeLoc T =
Node.getUnqualifiedLoc().castAs<TemplateSpecializationTypeLoc>();
assert(!T.isNull());
@@ -226,7 +226,7 @@ TEST(CXXNewExpr, TypeParenRange) {
class UnaryTransformTypeLocParensRangeVerifier : public RangeVerifier<TypeLoc> {
protected:
- virtual SourceRange getRange(const TypeLoc &Node) {
+ SourceRange getRange(const TypeLoc &Node) override {
UnaryTransformTypeLoc T =
Node.getUnqualifiedLoc().castAs<UnaryTransformTypeLoc>();
assert(!T.isNull());
diff --git a/clang/unittests/AST/StmtPrinterTest.cpp b/clang/unittests/AST/StmtPrinterTest.cpp
index 541fb3df1d9..b1fd2c1eb42 100644
--- a/clang/unittests/AST/StmtPrinterTest.cpp
+++ b/clang/unittests/AST/StmtPrinterTest.cpp
@@ -44,7 +44,7 @@ class PrintMatch : public MatchFinder::MatchCallback {
public:
PrintMatch() : NumFoundStmts(0) {}
- virtual void run(const MatchFinder::MatchResult &Result) {
+ void run(const MatchFinder::MatchResult &Result) override {
const Stmt *S = Result.Nodes.getStmtAs<Stmt>("id");
if (!S)
return;
OpenPOWER on IntegriCloud