File indexing completed on 2026-05-10 08:37:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
0010 #define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
0011
0012 #include "clang/Basic/LLVM.h"
0013 #include <optional>
0014 #include <type_traits>
0015
0016 namespace clang {
0017 namespace tooling {
0018
0019 class RefactoringOption;
0020
0021
0022
0023
0024
0025
0026 class RefactoringOptionVisitor {
0027 public:
0028 virtual ~RefactoringOptionVisitor() {}
0029
0030 virtual void visit(const RefactoringOption &Opt,
0031 std::optional<std::string> &Value) = 0;
0032 };
0033
0034 namespace traits {
0035 namespace internal {
0036
0037 template <typename T> struct HasHandle {
0038 private:
0039 template <typename ClassT>
0040 static auto check(ClassT *) -> typename std::is_same<
0041 decltype(std::declval<RefactoringOptionVisitor>().visit(
0042 std::declval<RefactoringOption>(),
0043 *std::declval<std::optional<T> *>())),
0044 void>::type;
0045
0046 template <typename> static std::false_type check(...);
0047
0048 public:
0049 using Type = decltype(check<RefactoringOptionVisitor>(nullptr));
0050 };
0051
0052 }
0053
0054
0055
0056 template <typename T>
0057 struct IsValidOptionType : internal::HasHandle<T>::Type {};
0058
0059 }
0060 }
0061 }
0062
0063 #endif