diff options
Diffstat (limited to 'unittests/Tooling/ToolingTest.cpp')
-rw-r--r-- | unittests/Tooling/ToolingTest.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/unittests/Tooling/ToolingTest.cpp b/unittests/Tooling/ToolingTest.cpp index 5a93e38..4b14ebb 100644 --- a/unittests/Tooling/ToolingTest.cpp +++ b/unittests/Tooling/ToolingTest.cpp @@ -35,8 +35,9 @@ public: : TestConsumer(std::move(TestConsumer)) {} protected: - virtual std::unique_ptr<clang::ASTConsumer> - CreateASTConsumer(clang::CompilerInstance &compiler, StringRef dummy) { + std::unique_ptr<clang::ASTConsumer> + CreateASTConsumer(clang::CompilerInstance &compiler, + StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. return std::move(TestConsumer); } @@ -49,7 +50,7 @@ class FindTopLevelDeclConsumer : public clang::ASTConsumer { public: explicit FindTopLevelDeclConsumer(bool *FoundTopLevelDecl) : FoundTopLevelDecl(FoundTopLevelDecl) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) { + bool HandleTopLevelDecl(clang::DeclGroupRef DeclGroup) override { *FoundTopLevelDecl = true; return true; } @@ -72,7 +73,7 @@ class FindClassDeclXConsumer : public clang::ASTConsumer { public: FindClassDeclXConsumer(bool *FoundClassDeclX) : FoundClassDeclX(FoundClassDeclX) {} - virtual bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) { + bool HandleTopLevelDecl(clang::DeclGroupRef GroupRef) override { if (CXXRecordDecl* Record = dyn_cast<clang::CXXRecordDecl>( *GroupRef.begin())) { if (Record->getName() == "X") { @@ -184,14 +185,11 @@ TEST(ToolInvocation, TestVirtualModulesCompilation) { struct VerifyEndCallback : public SourceFileCallbacks { VerifyEndCallback() : BeginCalled(0), EndCalled(0), Matched(false) {} - virtual bool handleBeginSource(CompilerInstance &CI, - StringRef Filename) override { + bool handleBeginSource(CompilerInstance &CI, StringRef Filename) override { ++BeginCalled; return true; } - virtual void handleEndSource() override { - ++EndCalled; - } + void handleEndSource() override { ++EndCalled; } std::unique_ptr<ASTConsumer> newASTConsumer() { return llvm::make_unique<FindTopLevelDeclConsumer>(&Matched); } @@ -225,15 +223,15 @@ TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) { struct SkipBodyConsumer : public clang::ASTConsumer { /// Skip the 'skipMe' function. - virtual bool shouldSkipFunctionBody(Decl *D) { + bool shouldSkipFunctionBody(Decl *D) override { FunctionDecl *F = dyn_cast<FunctionDecl>(D); return F && F->getNameAsString() == "skipMe"; } }; struct SkipBodyAction : public clang::ASTFrontendAction { - virtual std::unique_ptr<ASTConsumer> - CreateASTConsumer(CompilerInstance &Compiler, StringRef) { + std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, + StringRef) override { Compiler.getFrontendOpts().SkipFunctionBodies = true; return llvm::make_unique<SkipBodyConsumer>(); } @@ -312,8 +310,8 @@ TEST(ClangToolTest, BuildASTs) { struct TestDiagnosticConsumer : public DiagnosticConsumer { TestDiagnosticConsumer() : NumDiagnosticsSeen(0) {} - virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, - const Diagnostic &Info) { + void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, + const Diagnostic &Info) override { ++NumDiagnosticsSeen; } unsigned NumDiagnosticsSeen; |