clang-tools 10.0.0

Public Member Functions | List of all members
clang::tidy::ClangTidyCheck::OptionsView Class Reference

Provides access to the `ClangTidyCheck` options via check-local names. More...

`#include <ClangTidyCheck.h>`

## Public Member Functions
| OptionsView (StringRef CheckName, const ClangTidyOptions::OptionMap &CheckOptions)
| Initializes the instance using `CheckName` + "." as a prefix. More...
std::string | get (StringRef LocalName, StringRef Default) const
| Read a named option from the `Context`. More...
std::string | getLocalOrGlobal (StringRef LocalName, StringRef Default) const
| Read a named option from the `Context`. More...
template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type | get (StringRef LocalName, T Default) const
| Read a named option from the `Context` and parse it as an integral type `T`. More...
template<typename T >
std::enable_if< std::is_integral< T >::value, T >::type | getLocalOrGlobal (StringRef LocalName, T Default) const
| Read a named option from the `Context` and parse it as an integral type `T`. More...
void | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, StringRef Value) const
| Stores an option with the check-local name `LocalName` with string value `Value` to `Options`. More...
void | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, int64_t Value) const
| Stores an option with the check-local name `LocalName` with `int64_t` value `Value` to `Options`. More...

## Detailed Description

Provides access to the `ClangTidyCheck` options via check-local names.

Methods of this class prepend `CheckName + "."` to translate check-local option names to global option names.

Definition at line 108 of file ClangTidyCheck.h.

## Constructor & Destructor Documentation

## ◆ OptionsView()

clang::tidy::ClangTidyCheck::OptionsView::OptionsView | ( | StringRef | CheckName,
|  | const ClangTidyOptions::OptionMap & | CheckOptions
| ) |  |

Initializes the instance using `CheckName` + "." as a prefix.

Definition at line 33 of file ClangTidyCheck.cpp.

## Member Function Documentation

## ◆ get() [1/2]

std::string clang::tidy::ClangTidyCheck::OptionsView::get | ( | StringRef | LocalName,
|  | StringRef | Default
| ) |  | const

Read a named option from the `Context`.

Reads the option with the check-local name `LocalName` from the `CheckOptions`. If the corresponding key is not present, returns `Default`.

Definition at line 37 of file ClangTidyCheck.cpp.

## ◆ get() [2/2]

template<typename T >

std::enable_if<std::is_integral<T>::value, T>::type clang::tidy::ClangTidyCheck::OptionsView::get | ( | StringRef | LocalName,
|  | T | Default
| ) |  | const
| inline

Read a named option from the `Context` and parse it as an integral type `T`.

Reads the option with the check-local name `LocalName` from the `CheckOptions`. If the corresponding key is not present, returns `Default`.

Definition at line 137 of file ClangTidyCheck.h.

## ◆ getLocalOrGlobal() [1/2]

std::string clang::tidy::ClangTidyCheck::OptionsView::getLocalOrGlobal | ( | StringRef | LocalName,
|  | StringRef | Default
| ) |  | const

Read a named option from the `Context`.

Reads the option with the check-local name `LocalName` from local or global `CheckOptions`. Gets local option first. If local is not present, falls back to get global option. If global option is not present either, returns Default.

Definition at line 46 of file ClangTidyCheck.cpp.

Referenced by getLocalOrGlobal().

## ◆ getLocalOrGlobal() [2/2]

template<typename T >

std::enable_if<std::is_integral<T>::value, T>::type clang::tidy::ClangTidyCheck::OptionsView::getLocalOrGlobal | ( | StringRef | LocalName,
|  | T | Default
| ) |  | const
| inline

Read a named option from the `Context` and parse it as an integral type `T`.

Reads the option with the check-local name `LocalName` from local or global `CheckOptions`. Gets local option first. If local is not present, falls back to get global option. If global option is not present either, returns Default.

Definition at line 154 of file ClangTidyCheck.h.

References getLocalOrGlobal().

## ◆ store() [1/2]

void clang::tidy::ClangTidyCheck::OptionsView::store | ( | ClangTidyOptions::OptionMap & | Options,
|  | StringRef | LocalName,
|  | StringRef | Value
| ) |  | const

Stores an option with the check-local name `LocalName` with string value `Value` to `Options`.

Definition at line 58 of file ClangTidyCheck.cpp.

Referenced by store().

## ◆ store() [2/2]

void clang::tidy::ClangTidyCheck::OptionsView::store | ( | ClangTidyOptions::OptionMap & | Options,
|  | StringRef | LocalName,
|  | int64_t | Value
| ) |  | const

Stores an option with the check-local name `LocalName` with `int64_t` value `Value` to `Options`.

Definition at line 64 of file ClangTidyCheck.cpp.

References store().

The documentation for this class was generated from the following files:

- ClangTidyCheck.h
- ClangTidyCheck.cpp