clang 20.0.0git
RefactoringOptionVisitor.h
Go to the documentation of this file.
1//===--- RefactoringOptionVisitor.h - Clang refactoring library -----------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
10#define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
11
12#include "clang/Basic/LLVM.h"
13#include <optional>
14#include <type_traits>
15
16namespace clang {
17namespace tooling {
18
19class RefactoringOption;
20
21/// An interface that declares functions that handle different refactoring
22/// option types.
23///
24/// A valid refactoring option type must have a corresponding \c visit
25/// declaration in this interface.
27public:
29
30 virtual void visit(const RefactoringOption &Opt,
31 std::optional<std::string> &Value) = 0;
32};
33
34namespace traits {
35namespace internal {
36
37template <typename T> struct HasHandle {
38private:
39 template <typename ClassT>
40 static auto check(ClassT *) -> typename std::is_same<
41 decltype(std::declval<RefactoringOptionVisitor>().visit(
42 std::declval<RefactoringOption>(),
43 *std::declval<std::optional<T> *>())),
44 void>::type;
45
46 template <typename> static std::false_type check(...);
47
48public:
49 using Type = decltype(check<RefactoringOptionVisitor>(nullptr));
50};
51
52} // end namespace internal
53
54/// A type trait that returns true iff the given type is a type that can be
55/// stored in a refactoring option.
56template <typename T>
58
59} // end namespace traits
60} // end namespace tooling
61} // end namespace clang
62
63#endif // LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONVISITOR_H
MatchType Type
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
An interface that declares functions that handle different refactoring option types.
virtual void visit(const RefactoringOption &Opt, std::optional< std::string > &Value)=0
A refactoring option is an interface that describes a value that has an impact on the outcome of a re...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
A type trait that returns true iff the given type is a type that can be stored in a refactoring optio...
decltype(check< RefactoringOptionVisitor >(nullptr)) Type