1 //===--- ToolRefactoringResultConsumer.h - ----------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_CLANG_REFACTOR_TOOL_REFACTORING_RESULT_CONSUMER_H
10 #define LLVM_CLANG_TOOLS_CLANG_REFACTOR_TOOL_REFACTORING_RESULT_CONSUMER_H
12 #include "clang/AST/ASTContext.h"
13 #include "clang/Tooling/Refactoring/RefactoringResultConsumer.h"
18 /// An interface that subclasses the \c RefactoringResultConsumer interface
19 /// that stores the reference to the TU-specific diagnostics engine.
20 class ClangRefactorToolConsumerInterface
21 : public tooling::RefactoringResultConsumer
{
23 /// Called when a TU is entered.
24 void beginTU(ASTContext
&Context
) {
25 assert(!Diags
&& "Diags has been set");
26 Diags
= &Context
.getDiagnostics();
29 /// Called when the tool is done with a TU.
31 assert(Diags
&& "Diags unset");
35 DiagnosticsEngine
&getDiags() const {
36 assert(Diags
&& "no diags");
41 DiagnosticsEngine
*Diags
= nullptr;
44 } // end namespace refactor
45 } // end namespace clang
47 #endif // LLVM_CLANG_TOOLS_CLANG_REFACTOR_TOOL_REFACTORING_RESULT_CONSUMER_H