Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Tooling/Refactoring/RefactoringOption.h
Line
Count
Source
1
//===--- RefactoringOption.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_OPTION_H
10
#define LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_OPTION_H
11
12
#include "clang/Basic/LLVM.h"
13
#include <memory>
14
#include <type_traits>
15
16
namespace clang {
17
namespace tooling {
18
19
class RefactoringOptionVisitor;
20
21
/// A refactoring option is an interface that describes a value that
22
/// has an impact on the outcome of a refactoring.
23
///
24
/// Refactoring options can be specified using command-line arguments when
25
/// the clang-refactor tool is used.
26
class RefactoringOption {
27
public:
28
76
  virtual ~RefactoringOption() {}
29
30
  /// Returns the name of the refactoring option.
31
  ///
32
  /// Each refactoring option must have a unique name.
33
  virtual StringRef getName() const = 0;
34
35
  virtual StringRef getDescription() const = 0;
36
37
  /// True when this option must be specified before invoking the refactoring
38
  /// action.
39
  virtual bool isRequired() const = 0;
40
41
  /// Invokes the \c visit method in the option consumer that's appropriate
42
  /// for the option's value type.
43
  ///
44
  /// For example, if the option stores a string value, this method will
45
  /// invoke the \c visit method with a reference to an std::string value.
46
  virtual void passToVisitor(RefactoringOptionVisitor &Visitor) = 0;
47
};
48
49
/// Constructs a refactoring option of the given type.
50
///
51
/// The ownership of options is shared among requirements that use it because
52
/// one option can be used by multiple rules in a refactoring action.
53
template <typename OptionType>
54
76
std::shared_ptr<OptionType> createRefactoringOption() {
55
76
  static_assert(std::is_base_of<RefactoringOption, OptionType>::value,
56
76
                "invalid option type");
57
76
  return std::make_shared<OptionType>();
58
76
}
RefactoringActions.cpp:std::__1::shared_ptr<clang::tooling::(anonymous namespace)::NewNameOption> clang::tooling::createRefactoringOption<clang::tooling::(anonymous namespace)::NewNameOption>()
Line
Count
Source
54
19
std::shared_ptr<OptionType> createRefactoringOption() {
55
19
  static_assert(std::is_base_of<RefactoringOption, OptionType>::value,
56
19
                "invalid option type");
57
19
  return std::make_shared<OptionType>();
58
19
}
RefactoringActions.cpp:std::__1::shared_ptr<clang::tooling::(anonymous namespace)::OldQualifiedNameOption> clang::tooling::createRefactoringOption<clang::tooling::(anonymous namespace)::OldQualifiedNameOption>()
Line
Count
Source
54
19
std::shared_ptr<OptionType> createRefactoringOption() {
55
19
  static_assert(std::is_base_of<RefactoringOption, OptionType>::value,
56
19
                "invalid option type");
57
19
  return std::make_shared<OptionType>();
58
19
}
RefactoringActions.cpp:std::__1::shared_ptr<clang::tooling::(anonymous namespace)::NewQualifiedNameOption> clang::tooling::createRefactoringOption<clang::tooling::(anonymous namespace)::NewQualifiedNameOption>()
Line
Count
Source
54
19
std::shared_ptr<OptionType> createRefactoringOption() {
55
19
  static_assert(std::is_base_of<RefactoringOption, OptionType>::value,
56
19
                "invalid option type");
57
19
  return std::make_shared<OptionType>();
58
19
}
RefactoringActions.cpp:std::__1::shared_ptr<clang::tooling::(anonymous namespace)::DeclNameOption> clang::tooling::createRefactoringOption<clang::tooling::(anonymous namespace)::DeclNameOption>()
Line
Count
Source
54
19
std::shared_ptr<OptionType> createRefactoringOption() {
55
19
  static_assert(std::is_base_of<RefactoringOption, OptionType>::value,
56
19
                "invalid option type");
57
19
  return std::make_shared<OptionType>();
58
19
}
59
60
} // end namespace tooling
61
} // end namespace clang
62
63
#endif // LLVM_CLANG_TOOLING_REFACTOR_REFACTORING_OPTION_H