Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h
Line
Count
Source (jump to first uncovered line)
1
//===--- RefactoringActionRulesInternal.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_REFACTOR_REFACTORING_ACTION_RULES_INTERNAL_H
10
#define LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_ACTION_RULES_INTERNAL_H
11
12
#include "clang/Basic/LLVM.h"
13
#include "clang/Tooling/Refactoring/RefactoringActionRule.h"
14
#include "clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h"
15
#include "clang/Tooling/Refactoring/RefactoringResultConsumer.h"
16
#include "clang/Tooling/Refactoring/RefactoringRuleContext.h"
17
#include "llvm/Support/Error.h"
18
#include <type_traits>
19
20
namespace clang {
21
namespace tooling {
22
namespace internal {
23
24
65
inline llvm::Error findError() { return llvm::Error::success(); }
25
26
2
inline void ignoreError() {}
27
28
template <typename FirstT, typename... RestT>
29
1
void ignoreError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
30
1
  if (!First)
31
0
    llvm::consumeError(First.takeError());
32
1
  ignoreError(Rest...);
33
1
}
Unexecuted instantiation: void clang::tooling::internal::ignoreError<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)
void clang::tooling::internal::ignoreError<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(llvm::Expected<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&)
Line
Count
Source
29
1
void ignoreError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
30
1
  if (!First)
31
0
    llvm::consumeError(First.takeError());
32
1
  ignoreError(Rest...);
33
1
}
34
35
/// Scans the tuple and returns a valid \c Error if any of the values are
36
/// invalid.
37
template <typename FirstT, typename... RestT>
38
125
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
125
  if (!First) {
40
1
    ignoreError(Rest...);
41
1
    return First.takeError();
42
1
  }
43
124
  return findError(Rest...);
44
124
}
llvm::Error clang::tooling::internal::findError<clang::SourceRange, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(llvm::Expected<clang::SourceRange>&, llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)
Line
Count
Source
38
20
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
20
  if (!First) {
40
0
    ignoreError(Rest...);
41
0
    return First.takeError();
42
0
  }
43
20
  return findError(Rest...);
44
20
}
llvm::Error clang::tooling::internal::findError<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)
Line
Count
Source
38
21
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
21
  if (!First) {
40
0
    ignoreError(Rest...);
41
0
    return First.takeError();
42
0
  }
43
21
  return findError(Rest...);
44
21
}
llvm::Error clang::tooling::internal::findError<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&, llvm::Expected<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)
Line
Count
Source
38
1
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
1
  if (!First) {
40
0
    ignoreError(Rest...);
41
0
    return First.takeError();
42
0
  }
43
1
  return findError(Rest...);
44
1
}
llvm::Error clang::tooling::internal::findError<clang::tooling::CodeRangeASTSelection, llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(llvm::Expected<clang::tooling::CodeRangeASTSelection>&, llvm::Expected<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&)
Line
Count
Source
38
42
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
42
  if (!First) {
40
1
    ignoreError(Rest...);
41
1
    return First.takeError();
42
1
  }
43
41
  return findError(Rest...);
44
41
}
llvm::Error clang::tooling::internal::findError<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >(llvm::Expected<llvm::Optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&)
Line
Count
Source
38
41
llvm::Error findError(Expected<FirstT> &First, Expected<RestT> &... Rest) {
39
41
  if (!First) {
40
0
    ignoreError(Rest...);
41
0
    return First.takeError();
42
0
  }
43
41
  return findError(Rest...);
44
41
}
45
46
template <typename RuleType, typename... RequirementTypes, size_t... Is>
47
void invokeRuleAfterValidatingRequirements(
48
    RefactoringResultConsumer &Consumer, RefactoringRuleContext &Context,
49
    const std::tuple<RequirementTypes...> &Requirements,
50
63
    std::index_sequence<Is...>) {
51
63
  // Check if the requirements we're interested in can be evaluated.
52
63
  auto Values =
53
63
      std::make_tuple(std::get<Is>(Requirements).evaluate(Context)...);
54
63
  auto Err = findError(std::get<Is>(Values)...);
55
63
  if (Err)
56
1
    return Consumer.handleError(std::move(Err));
57
62
  // Construct the target action rule by extracting the evaluated
58
62
  // requirements from Expected<> wrappers and then run it.
59
62
  auto Rule =
60
62
      RuleType::initiate(Context, std::move((*std::get<Is>(Values)))...);
61
62
  if (!Rule)
62
23
    return Consumer.handleError(Rule.takeError());
63
39
  Rule->invoke(Consumer, Context);
64
39
}
RefactoringActions.cpp:void clang::tooling::internal::invokeRuleAfterValidatingRequirements<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption>, 0ul, 1ul>(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&, std::__1::tuple<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
50
20
    std::index_sequence<Is...>) {
51
20
  // Check if the requirements we're interested in can be evaluated.
52
20
  auto Values =
53
20
      std::make_tuple(std::get<Is>(Requirements).evaluate(Context)...);
54
20
  auto Err = findError(std::get<Is>(Values)...);
55
20
  if (Err)
56
0
    return Consumer.handleError(std::move(Err));
57
20
  // Construct the target action rule by extracting the evaluated
58
20
  // requirements from Expected<> wrappers and then run it.
59
20
  auto Rule =
60
20
      RuleType::initiate(Context, std::move((*std::get<Is>(Values)))...);
61
20
  if (!Rule)
62
8
    return Consumer.handleError(Rule.takeError());
63
12
  Rule->invoke(Consumer, Context);
64
12
}
RefactoringActions.cpp:void clang::tooling::internal::invokeRuleAfterValidatingRequirements<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption>, 0ul, 1ul>(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&, std::__1::tuple<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
50
1
    std::index_sequence<Is...>) {
51
1
  // Check if the requirements we're interested in can be evaluated.
52
1
  auto Values =
53
1
      std::make_tuple(std::get<Is>(Requirements).evaluate(Context)...);
54
1
  auto Err = findError(std::get<Is>(Values)...);
55
1
  if (Err)
56
0
    return Consumer.handleError(std::move(Err));
57
1
  // Construct the target action rule by extracting the evaluated
58
1
  // requirements from Expected<> wrappers and then run it.
59
1
  auto Rule =
60
1
      RuleType::initiate(Context, std::move((*std::get<Is>(Values)))...);
61
1
  if (!Rule)
62
0
    return Consumer.handleError(Rule.takeError());
63
1
  Rule->invoke(Consumer, Context);
64
1
}
RefactoringActions.cpp:void clang::tooling::internal::invokeRuleAfterValidatingRequirements<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption>, 0ul, 1ul>(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&, std::__1::tuple<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
50
42
    std::index_sequence<Is...>) {
51
42
  // Check if the requirements we're interested in can be evaluated.
52
42
  auto Values =
53
42
      std::make_tuple(std::get<Is>(Requirements).evaluate(Context)...);
54
42
  auto Err = findError(std::get<Is>(Values)...);
55
42
  if (Err)
56
1
    return Consumer.handleError(std::move(Err));
57
41
  // Construct the target action rule by extracting the evaluated
58
41
  // requirements from Expected<> wrappers and then run it.
59
41
  auto Rule =
60
41
      RuleType::initiate(Context, std::move((*std::get<Is>(Values)))...);
61
41
  if (!Rule)
62
15
    return Consumer.handleError(Rule.takeError());
63
26
  Rule->invoke(Consumer, Context);
64
26
}
65
66
87
inline void visitRefactoringOptionsImpl(RefactoringOptionVisitor &) {}
67
68
/// Scans the list of requirements in a rule and visits all the refactoring
69
/// options that are used by all the requirements.
70
template <typename FirstT, typename... RestT>
71
void visitRefactoringOptionsImpl(RefactoringOptionVisitor &Visitor,
72
174
                                 const FirstT &First, const RestT &... Rest) {
73
174
  struct OptionGatherer {
74
174
    RefactoringOptionVisitor &Visitor;
75
174
76
174
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
118
      for (const auto &Option : Requirement.getRefactoringOptions())
78
118
        Option->passToVisitor(Visitor);
79
118
    }
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
Line
Count
Source
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
Line
Count
Source
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
Line
Count
Source
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
Line
Count
Source
76
25
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
25
      for (const auto &Option : Requirement.getRefactoringOptions())
78
25
        Option->passToVisitor(Visitor);
79
25
    }
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringOptionsRequirement const&)
80
174
    void operator()(const RefactoringActionRuleRequirement &) 
{}56
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
Line
Count
Source
80
31
    void operator()(const RefactoringActionRuleRequirement &) {}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
Line
Count
Source
80
25
    void operator()(const RefactoringActionRuleRequirement &) {}
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
Unexecuted instantiation: RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::OptionGatherer::operator()(clang::tooling::RefactoringActionRuleRequirement const&)
81
174
  };
82
174
  (OptionGatherer{Visitor})(First);
83
174
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
174
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)
Line
Count
Source
72
31
                                 const FirstT &First, const RestT &... Rest) {
73
31
  struct OptionGatherer {
74
31
    RefactoringOptionVisitor &Visitor;
75
31
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
80
31
    void operator()(const RefactoringActionRuleRequirement &) {}
81
31
  };
82
31
  (OptionGatherer{Visitor})(First);
83
31
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)
Line
Count
Source
72
31
                                 const FirstT &First, const RestT &... Rest) {
73
31
  struct OptionGatherer {
74
31
    RefactoringOptionVisitor &Visitor;
75
31
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
80
31
    void operator()(const RefactoringActionRuleRequirement &) {}
81
31
  };
82
31
  (OptionGatherer{Visitor})(First);
83
31
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)
Line
Count
Source
72
31
                                 const FirstT &First, const RestT &... Rest) {
73
31
  struct OptionGatherer {
74
31
    RefactoringOptionVisitor &Visitor;
75
31
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
80
31
    void operator()(const RefactoringActionRuleRequirement &) {}
81
31
  };
82
31
  (OptionGatherer{Visitor})(First);
83
31
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)
Line
Count
Source
72
31
                                 const FirstT &First, const RestT &... Rest) {
73
31
  struct OptionGatherer {
74
31
    RefactoringOptionVisitor &Visitor;
75
31
76
31
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
31
      for (const auto &Option : Requirement.getRefactoringOptions())
78
31
        Option->passToVisitor(Visitor);
79
31
    }
80
31
    void operator()(const RefactoringActionRuleRequirement &) {}
81
31
  };
82
31
  (OptionGatherer{Visitor})(First);
83
31
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)
Line
Count
Source
72
25
                                 const FirstT &First, const RestT &... Rest) {
73
25
  struct OptionGatherer {
74
25
    RefactoringOptionVisitor &Visitor;
75
25
76
25
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
25
      for (const auto &Option : Requirement.getRefactoringOptions())
78
25
        Option->passToVisitor(Visitor);
79
25
    }
80
25
    void operator()(const RefactoringActionRuleRequirement &) {}
81
25
  };
82
25
  (OptionGatherer{Visitor})(First);
83
25
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
25
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptionsImpl<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::RefactoringOptionVisitor&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)
Line
Count
Source
72
25
                                 const FirstT &First, const RestT &... Rest) {
73
25
  struct OptionGatherer {
74
25
    RefactoringOptionVisitor &Visitor;
75
25
76
25
    void operator()(const RefactoringOptionsRequirement &Requirement) {
77
25
      for (const auto &Option : Requirement.getRefactoringOptions())
78
25
        Option->passToVisitor(Visitor);
79
25
    }
80
25
    void operator()(const RefactoringActionRuleRequirement &) {}
81
25
  };
82
25
  (OptionGatherer{Visitor})(First);
83
25
  return visitRefactoringOptionsImpl(Visitor, Rest...);
84
25
}
85
86
template <typename... RequirementTypes, size_t... Is>
87
void visitRefactoringOptions(
88
    RefactoringOptionVisitor &Visitor,
89
    const std::tuple<RequirementTypes...> &Requirements,
90
87
    std::index_sequence<Is...>) {
91
87
  visitRefactoringOptionsImpl(Visitor, std::get<Is>(Requirements)...);
92
87
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptions<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption>, 0ul, 1ul>(clang::tooling::RefactoringOptionVisitor&, std::__1::tuple<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
90
31
    std::index_sequence<Is...>) {
91
31
  visitRefactoringOptionsImpl(Visitor, std::get<Is>(Requirements)...);
92
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptions<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption>, 0ul, 1ul>(clang::tooling::RefactoringOptionVisitor&, std::__1::tuple<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
90
31
    std::index_sequence<Is...>) {
91
31
  visitRefactoringOptionsImpl(Visitor, std::get<Is>(Requirements)...);
92
31
}
RefactoringActions.cpp:void clang::tooling::internal::visitRefactoringOptions<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption>, 0ul, 1ul>(clang::tooling::RefactoringOptionVisitor&, std::__1::tuple<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> > const&, std::__1::integer_sequence<unsigned long, 0ul, 1ul>)
Line
Count
Source
90
25
    std::index_sequence<Is...>) {
91
25
  visitRefactoringOptionsImpl(Visitor, std::get<Is>(Requirements)...);
92
25
}
93
94
/// A type trait that returns true when the given type list has at least one
95
/// type whose base is the given base type.
96
template <typename Base, typename First, typename... Rest>
97
struct HasBaseOf : std::conditional<HasBaseOf<Base, First>::value ||
98
                                        HasBaseOf<Base, Rest...>::value,
99
                                    std::true_type, std::false_type>::type {};
100
101
template <typename Base, typename T>
102
struct HasBaseOf<Base, T> : std::is_base_of<Base, T> {};
103
104
/// A type trait that returns true when the given type list contains types that
105
/// derive from Base.
106
template <typename Base, typename First, typename... Rest>
107
struct AreBaseOf : std::conditional<AreBaseOf<Base, First>::value &&
108
                                        AreBaseOf<Base, Rest...>::value,
109
                                    std::true_type, std::false_type>::type {};
110
111
template <typename Base, typename T>
112
struct AreBaseOf<Base, T> : std::is_base_of<Base, T> {};
113
114
} // end namespace internal
115
116
template <typename RuleType, typename... RequirementTypes>
117
std::unique_ptr<RefactoringActionRule>
118
57
createRefactoringActionRule(const RequirementTypes &... Requirements) {
119
57
  static_assert(std::is_base_of<RefactoringActionRuleBase, RuleType>::value,
120
57
                "Expected a refactoring action rule type");
121
57
  static_assert(internal::AreBaseOf<RefactoringActionRuleRequirement,
122
57
                                    RequirementTypes...>::value,
123
57
                "Expected a list of refactoring action rules");
124
57
125
57
  class Rule final : public RefactoringActionRule {
126
57
  public:
127
57
    Rule(std::tuple<RequirementTypes...> Requirements)
128
57
        : Requirements(Requirements) {}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::Rule::Rule(std::__1::tuple<clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >)
Line
Count
Source
128
19
        : Requirements(Requirements) {}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::Rule::Rule(std::__1::tuple<clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >)
Line
Count
Source
128
19
        : Requirements(Requirements) {}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::Rule::Rule(std::__1::tuple<clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >)
Line
Count
Source
128
19
        : Requirements(Requirements) {}
129
57
130
57
    void invoke(RefactoringResultConsumer &Consumer,
131
63
                RefactoringRuleContext &Context) override {
132
63
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
63
          Consumer, Context, Requirements,
134
63
          std::index_sequence_for<RequirementTypes...>());
135
63
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::Rule::invoke(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&)
Line
Count
Source
131
20
                RefactoringRuleContext &Context) override {
132
20
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
20
          Consumer, Context, Requirements,
134
20
          std::index_sequence_for<RequirementTypes...>());
135
20
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::Rule::invoke(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&)
Line
Count
Source
131
1
                RefactoringRuleContext &Context) override {
132
1
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
1
          Consumer, Context, Requirements,
134
1
          std::index_sequence_for<RequirementTypes...>());
135
1
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::Rule::invoke(clang::tooling::RefactoringResultConsumer&, clang::tooling::RefactoringRuleContext&)
Line
Count
Source
131
42
                RefactoringRuleContext &Context) override {
132
42
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
42
          Consumer, Context, Requirements,
134
42
          std::index_sequence_for<RequirementTypes...>());
135
42
    }
136
57
137
74
    bool hasSelectionRequirement() override {
138
74
      return internal::HasBaseOf<SourceSelectionRequirement,
139
74
                                 RequirementTypes...>::value;
140
74
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::Rule::hasSelectionRequirement()
Line
Count
Source
137
41
    bool hasSelectionRequirement() override {
138
41
      return internal::HasBaseOf<SourceSelectionRequirement,
139
41
                                 RequirementTypes...>::value;
140
41
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::Rule::hasSelectionRequirement()
Line
Count
Source
137
2
    bool hasSelectionRequirement() override {
138
2
      return internal::HasBaseOf<SourceSelectionRequirement,
139
2
                                 RequirementTypes...>::value;
140
2
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::Rule::hasSelectionRequirement()
Line
Count
Source
137
31
    bool hasSelectionRequirement() override {
138
31
      return internal::HasBaseOf<SourceSelectionRequirement,
139
31
                                 RequirementTypes...>::value;
140
31
    }
141
57
142
87
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
87
      internal::visitRefactoringOptions(
144
87
          Visitor, Requirements,
145
87
          std::index_sequence_for<RequirementTypes...>());
146
87
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)::Rule::visitRefactoringOptions(clang::tooling::RefactoringOptionVisitor&)
Line
Count
Source
142
31
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
31
      internal::visitRefactoringOptions(
144
31
          Visitor, Requirements,
145
31
          std::index_sequence_for<RequirementTypes...>());
146
31
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)::Rule::visitRefactoringOptions(clang::tooling::RefactoringOptionVisitor&)
Line
Count
Source
142
31
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
31
      internal::visitRefactoringOptions(
144
31
          Visitor, Requirements,
145
31
          std::index_sequence_for<RequirementTypes...>());
146
31
    }
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)::Rule::visitRefactoringOptions(clang::tooling::RefactoringOptionVisitor&)
Line
Count
Source
142
25
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
25
      internal::visitRefactoringOptions(
144
25
          Visitor, Requirements,
145
25
          std::index_sequence_for<RequirementTypes...>());
146
25
    }
147
57
  private:
148
57
    std::tuple<RequirementTypes...> Requirements;
149
57
  };
150
57
151
57
  return std::make_unique<Rule>(std::make_tuple(Requirements...));
152
57
}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::RenameOccurrences, clang::tooling::SourceRangeSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> >(clang::tooling::SourceRangeSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewNameOption> const&)
Line
Count
Source
118
19
createRefactoringActionRule(const RequirementTypes &... Requirements) {
119
19
  static_assert(std::is_base_of<RefactoringActionRuleBase, RuleType>::value,
120
19
                "Expected a refactoring action rule type");
121
19
  static_assert(internal::AreBaseOf<RefactoringActionRuleRequirement,
122
19
                                    RequirementTypes...>::value,
123
19
                "Expected a list of refactoring action rules");
124
19
125
19
  class Rule final : public RefactoringActionRule {
126
19
  public:
127
19
    Rule(std::tuple<RequirementTypes...> Requirements)
128
19
        : Requirements(Requirements) {}
129
19
130
19
    void invoke(RefactoringResultConsumer &Consumer,
131
19
                RefactoringRuleContext &Context) override {
132
19
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
19
          Consumer, Context, Requirements,
134
19
          std::index_sequence_for<RequirementTypes...>());
135
19
    }
136
19
137
19
    bool hasSelectionRequirement() override {
138
19
      return internal::HasBaseOf<SourceSelectionRequirement,
139
19
                                 RequirementTypes...>::value;
140
19
    }
141
19
142
19
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
19
      internal::visitRefactoringOptions(
144
19
          Visitor, Requirements,
145
19
          std::index_sequence_for<RequirementTypes...>());
146
19
    }
147
19
  private:
148
19
    std::tuple<RequirementTypes...> Requirements;
149
19
  };
150
19
151
19
  return std::make_unique<Rule>(std::make_tuple(Requirements...));
152
19
}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::QualifiedRenameRule, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> >(clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> const&)
Line
Count
Source
118
19
createRefactoringActionRule(const RequirementTypes &... Requirements) {
119
19
  static_assert(std::is_base_of<RefactoringActionRuleBase, RuleType>::value,
120
19
                "Expected a refactoring action rule type");
121
19
  static_assert(internal::AreBaseOf<RefactoringActionRuleRequirement,
122
19
                                    RequirementTypes...>::value,
123
19
                "Expected a list of refactoring action rules");
124
19
125
19
  class Rule final : public RefactoringActionRule {
126
19
  public:
127
19
    Rule(std::tuple<RequirementTypes...> Requirements)
128
19
        : Requirements(Requirements) {}
129
19
130
19
    void invoke(RefactoringResultConsumer &Consumer,
131
19
                RefactoringRuleContext &Context) override {
132
19
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
19
          Consumer, Context, Requirements,
134
19
          std::index_sequence_for<RequirementTypes...>());
135
19
    }
136
19
137
19
    bool hasSelectionRequirement() override {
138
19
      return internal::HasBaseOf<SourceSelectionRequirement,
139
19
                                 RequirementTypes...>::value;
140
19
    }
141
19
142
19
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
19
      internal::visitRefactoringOptions(
144
19
          Visitor, Requirements,
145
19
          std::index_sequence_for<RequirementTypes...>());
146
19
    }
147
19
  private:
148
19
    std::tuple<RequirementTypes...> Requirements;
149
19
  };
150
19
151
19
  return std::make_unique<Rule>(std::make_tuple(Requirements...));
152
19
}
RefactoringActions.cpp:std::__1::unique_ptr<clang::tooling::RefactoringActionRule, std::__1::default_delete<clang::tooling::RefactoringActionRule> > clang::tooling::createRefactoringActionRule<clang::tooling::ExtractFunction, clang::tooling::CodeRangeASTSelectionRequirement, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> >(clang::tooling::CodeRangeASTSelectionRequirement const&, clang::tooling::OptionRequirement<clang::tooling::(anonymous namespace)::DeclNameOption> const&)
Line
Count
Source
118
19
createRefactoringActionRule(const RequirementTypes &... Requirements) {
119
19
  static_assert(std::is_base_of<RefactoringActionRuleBase, RuleType>::value,
120
19
                "Expected a refactoring action rule type");
121
19
  static_assert(internal::AreBaseOf<RefactoringActionRuleRequirement,
122
19
                                    RequirementTypes...>::value,
123
19
                "Expected a list of refactoring action rules");
124
19
125
19
  class Rule final : public RefactoringActionRule {
126
19
  public:
127
19
    Rule(std::tuple<RequirementTypes...> Requirements)
128
19
        : Requirements(Requirements) {}
129
19
130
19
    void invoke(RefactoringResultConsumer &Consumer,
131
19
                RefactoringRuleContext &Context) override {
132
19
      internal::invokeRuleAfterValidatingRequirements<RuleType>(
133
19
          Consumer, Context, Requirements,
134
19
          std::index_sequence_for<RequirementTypes...>());
135
19
    }
136
19
137
19
    bool hasSelectionRequirement() override {
138
19
      return internal::HasBaseOf<SourceSelectionRequirement,
139
19
                                 RequirementTypes...>::value;
140
19
    }
141
19
142
19
    void visitRefactoringOptions(RefactoringOptionVisitor &Visitor) override {
143
19
      internal::visitRefactoringOptions(
144
19
          Visitor, Requirements,
145
19
          std::index_sequence_for<RequirementTypes...>());
146
19
    }
147
19
  private:
148
19
    std::tuple<RequirementTypes...> Requirements;
149
19
  };
150
19
151
19
  return std::make_unique<Rule>(std::make_tuple(Requirements...));
152
19
}
153
154
} // end namespace tooling
155
} // end namespace clang
156
157
#endif // LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_ACTION_RULES_INTERNAL_H