clang 19.0.0git
RefactoringOptions.h
Go to the documentation of this file.
1//===--- RefactoringOptions.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_REFACTORINGOPTIONS_H
10#define LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONS_H
11
12#include "clang/Basic/LLVM.h"
16#include "llvm/Support/Error.h"
17#include <optional>
18#include <type_traits>
19
20namespace clang {
21namespace tooling {
22
23/// A refactoring option that stores a value of type \c T.
24template <typename T,
25 typename = std::enable_if_t<traits::IsValidOptionType<T>::value>>
27public:
29 Visitor.visit(*this, Value);
30 }
31
32 bool isRequired() const override { return false; }
33
34 using ValueType = std::optional<T>;
35
36 const ValueType &getValue() const { return Value; }
37
38protected:
39 std::optional<T> Value;
40};
41
42/// A required refactoring option that stores a value of type \c T.
43template <typename T,
44 typename = std::enable_if_t<traits::IsValidOptionType<T>::value>>
46public:
47 using ValueType = T;
48
49 const ValueType &getValue() const {
51 }
52 bool isRequired() const final { return true; }
53};
54
55} // end namespace tooling
56} // end namespace clang
57
58#endif // LLVM_CLANG_TOOLING_REFACTORING_REFACTORINGOPTIONS_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
A refactoring option that stores a value of type T.
bool isRequired() const override
True when this option must be specified before invoking the refactoring action.
void passToVisitor(RefactoringOptionVisitor &Visitor) final
Invokes the visit method in the option consumer that's appropriate for the option's value type.
An interface that declares functions that handle different refactoring option types.
A refactoring option is an interface that describes a value that has an impact on the outcome of a re...
A required refactoring option that stores a value of type T.
bool isRequired() const final
True when this option must be specified before invoking the refactoring action.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T