|
|
|||
File indexing completed on 2026-05-10 08:37:11
0001 //===--- RefactoringResultConsumer.h - Clang refactoring library ----------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGRESULTCONSUMER_H 0010 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGRESULTCONSUMER_H 0011 0012 #include "clang/Basic/LLVM.h" 0013 #include "clang/Tooling/Refactoring/AtomicChange.h" 0014 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h" 0015 #include "llvm/Support/Error.h" 0016 0017 namespace clang { 0018 namespace tooling { 0019 0020 /// An abstract interface that consumes the various refactoring results that can 0021 /// be produced by refactoring actions. 0022 /// 0023 /// A valid refactoring result must be handled by a \c handle method. 0024 class RefactoringResultConsumer { 0025 public: 0026 virtual ~RefactoringResultConsumer() {} 0027 0028 /// Handles an initiation or an invication error. An initiation error typically 0029 /// has a \c DiagnosticError payload that describes why initiation failed. 0030 virtual void handleError(llvm::Error Err) = 0; 0031 0032 /// Handles the source replacements that are produced by a refactoring action. 0033 virtual void handle(AtomicChanges SourceReplacements) { 0034 defaultResultHandler(); 0035 } 0036 0037 /// Handles the symbol occurrences that are found by an interactive 0038 /// refactoring action. 0039 virtual void handle(SymbolOccurrences Occurrences) { defaultResultHandler(); } 0040 0041 private: 0042 void defaultResultHandler() { 0043 handleError(llvm::make_error<llvm::StringError>( 0044 "unsupported refactoring result", llvm::inconvertibleErrorCode())); 0045 } 0046 }; 0047 0048 } // end namespace tooling 0049 } // end namespace clang 0050 0051 #endif // LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGRESULTCONSUMER_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|