clang-tools  6.0.0svn
Public Member Functions | List of all members
clang::tidy::OptionsView Class Reference

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

#include <ClangTidy.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 39 of file ClangTidy.h.

Constructor & Destructor Documentation

◆ OptionsView()

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

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

Definition at line 426 of file ClangTidy.cpp.

Member Function Documentation

◆ get() [1/2]

std::string clang::tidy::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 430 of file ClangTidy.cpp.

◆ get() [2/2]

template<typename T >
std::enable_if<std::is_integral<T>::value, T>::type clang::tidy::OptionsView::get ( StringRef  LocalName,
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 68 of file ClangTidy.h.

◆ getLocalOrGlobal() [1/2]

std::string clang::tidy::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 437 of file ClangTidy.cpp.

◆ getLocalOrGlobal() [2/2]

template<typename T >
std::enable_if<std::is_integral<T>::value, T>::type clang::tidy::OptionsView::getLocalOrGlobal ( StringRef  LocalName,
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 85 of file ClangTidy.h.

◆ store() [1/2]

void clang::tidy::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 449 of file ClangTidy.cpp.

Referenced by store(), clang::tidy::modernize::UseNullptrCheck::storeOptions(), clang::tidy::modernize::LoopConvertCheck::storeOptions(), clang::tidy::modernize::PassByValueCheck::storeOptions(), clang::tidy::performance::ForRangeCopyCheck::storeOptions(), clang::tidy::misc::SuspiciousStringCompareCheck::storeOptions(), clang::tidy::readability::ImplicitBoolConversionCheck::storeOptions(), clang::tidy::misc::SizeofExpressionCheck::storeOptions(), clang::tidy::bugprone::StringConstructorCheck::storeOptions(), clang::tidy::misc::SuspiciousMissingCommaCheck::storeOptions(), clang::tidy::modernize::UseDefaultMemberInitCheck::storeOptions(), clang::tidy::google::runtime::NonConstReferences::storeOptions(), clang::tidy::modernize::UseTransparentFunctorsCheck::storeOptions(), clang::tidy::readability::SimplifyBooleanExprCheck::storeOptions(), clang::tidy::misc::SuspiciousEnumUsageCheck::storeOptions(), clang::tidy::bugprone::DanglingHandleCheck::storeOptions(), clang::tidy::modernize::UseUsingCheck::storeOptions(), clang::tidy::modernize::ReplaceRandomShuffleCheck::storeOptions(), clang::tidy::performance::InefficientVectorOperationCheck::storeOptions(), clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::storeOptions(), clang::tidy::performance::UnnecessaryValueParamCheck::storeOptions(), clang::tidy::modernize::MakeSmartPtrCheck::storeOptions(), clang::tidy::objc::ForbiddenSubclassingCheck::storeOptions(), clang::tidy::misc::ThrowByValueCatchByReferenceCheck::storeOptions(), clang::tidy::performance::MoveConstructorInitCheck::storeOptions(), clang::tidy::google::readability::GlobalNamesInHeadersCheck::storeOptions(), clang::tidy::performance::FasterStringFindCheck::storeOptions(), clang::tidy::modernize::UseEmplaceCheck::storeOptions(), clang::tidy::objc::PropertyDeclarationCheck::storeOptions(), clang::tidy::performance::TypePromotionInMathFnCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProBoundsConstantArrayIndexCheck::storeOptions(), clang::tidy::google::runtime::IntegerTypesCheck::storeOptions(), clang::tidy::misc::MisplacedWideningCastCheck::storeOptions(), clang::tidy::google::build::UnnamedNamespaceInHeaderCheck::storeOptions(), clang::tidy::modernize::UseNoexceptCheck::storeOptions(), clang::tidy::misc::DefinitionsInHeadersCheck::storeOptions(), clang::tidy::bugprone::AssertSideEffectCheck::storeOptions(), clang::tidy::readability::IdentifierNamingCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::storeOptions(), clang::tidy::readability::FunctionSizeCheck::storeOptions(), clang::tidy::bugprone::ArgumentCommentCheck::storeOptions(), clang::tidy::modernize::UseEqualsDefaultCheck::storeOptions(), and clang::tidy::readability::BracesAroundStatementsCheck::storeOptions().

◆ store() [2/2]

void clang::tidy::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 454 of file ClangTidy.cpp.

References store().


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