clang  6.0.0svn
RefactoringOptionVisitor.h
Go to the documentation of this file.
1 //===--- RefactoringOptionVisitor.h - Clang refactoring library -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_OPTION_VISITOR_H
11 #define LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_OPTION_VISITOR_H
12 
13 #include "clang/Basic/LLVM.h"
14 #include <type_traits>
15 
16 namespace clang {
17 namespace tooling {
18 
19 class 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.
27 public:
29 
30  virtual void visit(const RefactoringOption &Opt,
32 };
33 
34 namespace traits {
35 namespace internal {
36 
37 template <typename T> struct HasHandle {
38 private:
39  template <typename ClassT>
40  static auto check(ClassT *) -> typename std::is_same<
41  decltype(std::declval<RefactoringOptionVisitor>().visit(
42  std::declval<RefactoringOption>(), *std::declval<Optional<T> *>())),
43  void>::type;
44 
45  template <typename> static std::false_type check(...);
46 
47 public:
48  using Type = decltype(check<RefactoringOptionVisitor>(nullptr));
49 };
50 
51 } // end namespace internal
52 
53 /// A type trait that returns true iff the given type is a type that can be
54 /// stored in a refactoring option.
55 template <typename T>
57 
58 } // end namespace traits
59 } // end namespace tooling
60 } // end namespace clang
61 
62 #endif // LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_OPTION_VISITOR_H
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
An interface that declares functions that handle different refactoring option types.
The base class of the type hierarchy.
Definition: Type.h:1353
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
A type trait that returns true iff the given type is a type that can be stored in a refactoring optio...
A refactoring option is an interface that describes a value that has an impact on the outcome of a re...
Dataflow Directional Tag Classes.
virtual void visit(const RefactoringOption &Opt, Optional< std::string > &Value)=0
decltype(check< RefactoringOptionVisitor >(nullptr)) Type