clang-tools 20.0.0git
|
Provides access to the ClangTidyCheck
options via check-local names.
More...
#include <ClangTidyCheck.h>
Public Member Functions | |
OptionsView (StringRef CheckName, const ClangTidyOptions::OptionMap &CheckOptions, ClangTidyContext *Context) | |
Initializes the instance using CheckName + "." as a prefix. | |
std::optional< StringRef > | get (StringRef LocalName) const |
Read a named option from the Context . | |
StringRef | get (StringRef LocalName, StringRef Default) const |
Read a named option from the Context . | |
std::optional< StringRef > | getLocalOrGlobal (StringRef LocalName) const |
Read a named option from the Context . | |
StringRef | getLocalOrGlobal (StringRef LocalName, StringRef Default) const |
Read a named option from the Context . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | get (StringRef LocalName) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | get (StringRef LocalName, std::optional< T > Default) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, T > | get (StringRef LocalName, T Default) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | getLocalOrGlobal (StringRef LocalName) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | getLocalOrGlobal (StringRef LocalName, std::optional< T > Default) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, T > | getLocalOrGlobal (StringRef LocalName, T Default) const |
Read a named option from the Context and parse it as an integral type T . | |
template<typename T > | |
std::enable_if_t< std::is_enum_v< T >, std::optional< T > > | get (StringRef LocalName, bool IgnoreCase=false) const |
Read a named option from the Context and parse it as an enum type T . | |
template<typename T > | |
std::enable_if_t< std::is_enum_v< T >, T > | get (StringRef LocalName, T Default, bool IgnoreCase=false) const |
Read a named option from the Context and parse it as an enum type T . | |
template<typename T > | |
std::enable_if_t< std::is_enum_v< T >, std::optional< T > > | getLocalOrGlobal (StringRef LocalName, bool IgnoreCase=false) const |
Read a named option from the Context and parse it as an enum type T . | |
template<typename T > | |
std::enable_if_t< std::is_enum_v< T >, T > | getLocalOrGlobal (StringRef LocalName, T Default, bool IgnoreCase=false) const |
Read a named option from the Context and parse it as an enum type T . | |
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 . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T > > | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, T Value) const |
Stores an option with the check-local name LocalName with integer value Value to Options . | |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T > > | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, std::optional< T > Value) const |
Stores an option with the check-local name LocalName with integer value Value to Options . | |
template<typename T > | |
std::enable_if_t< std::is_enum_v< T > > | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, T Value) const |
Stores an option with the check-local name LocalName as the string representation of the Enum Value to Options . | |
template<> | |
std::optional< bool > | get (StringRef LocalName) const |
Read a named option from the Context and parse it as a bool. | |
template<> | |
std::optional< bool > | getLocalOrGlobal (StringRef LocalName) const |
Read a named option from the Context and parse it as a bool. | |
template<> | |
void | store (ClangTidyOptions::OptionMap &Options, StringRef LocalName, bool Value) const |
Stores an option with the check-local name LocalName with bool value Value to Options . | |
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 139 of file ClangTidyCheck.h.
clang::tidy::ClangTidyCheck::OptionsView::OptionsView | ( | StringRef | CheckName, |
const ClangTidyOptions::OptionMap & | CheckOptions, | ||
ClangTidyContext * | Context | ||
) |
Initializes the instance using CheckName
+ "." as a prefix.
Definition at line 49 of file ClangTidyCheck.cpp.
std::optional< bool > clang::tidy::ClangTidyCheck::OptionsView::get< bool > | ( | StringRef | LocalName | ) | const |
Read a named option from the Context
and parse it as a bool.
Reads the option with the check-local name LocalName
from the CheckOptions
. If the corresponding key is not present, return std::nullopt
.
If the corresponding key can't be parsed as a bool, emit a diagnostic and return std::nullopt
.
Definition at line 93 of file ClangTidyCheck.cpp.
References Number.
std::optional< StringRef > clang::tidy::ClangTidyCheck::OptionsView::get | ( | StringRef | LocalName | ) | 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, return std::nullopt
.
Definition at line 56 of file ClangTidyCheck.cpp.
References clang::tidy::ClangTidyContext::getOptionsCollector().
Referenced by get(), clang::tidy::readability::IdentifierNamingCheck::getFileStyleFromOptions(), getLocalOrGlobal(), clang::tidy::readability::IdentifierNamingCheck::HungarianNotation::loadFileConfig(), clang::tidy::readability::SuspiciousCallArgumentCheck::SuspiciousCallArgumentCheck(), and clang::tidy::bugprone::TaggedUnionMemberCountCheck::TaggedUnionMemberCountCheck().
|
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, return std::nullopt
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return std::nullopt
.
Definition at line 194 of file ClangTidyCheck.h.
References get().
|
inline |
Read a named option from the Context
and parse it as an enum type T
.
Reads the option with the check-local name LocalName
from the CheckOptions
. If the corresponding key is not present, return std::nullopt
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return std::nullopt
.
clang::tidy::OptionEnumMapping must be specialized for T
to supply the mapping required to convert between T
and a string.
Definition at line 336 of file ClangTidyCheck.h.
|
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 none
, null
, -1
or empty, return std::nullopt
. If the corresponding key is not present, return Default
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
Definition at line 216 of file ClangTidyCheck.h.
References get().
StringRef 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 224 of file ClangTidyCheck.cpp.
|
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, return Default
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
Definition at line 239 of file ClangTidyCheck.h.
|
inline |
Read a named option from the Context
and parse it as an enum type T
.
Reads the option with the check-local name LocalName
from the CheckOptions
. If the corresponding key is not present, return Default
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
clang::tidy::OptionEnumMapping must be specialized for T
to supply the mapping required to convert between T
and a string.
Definition at line 356 of file ClangTidyCheck.h.
std::optional< bool > clang::tidy::ClangTidyCheck::OptionsView::getLocalOrGlobal< bool > | ( | StringRef | LocalName | ) | const |
Read a named option from the Context
and parse it as a bool.
Reads the option with the check-local name LocalName
from the CheckOptions
. If the corresponding key is not present, return Default
.
If the corresponding key can't be parsed as a bool, emit a diagnostic and return Default
.
Definition at line 93 of file ClangTidyCheck.cpp.
std::optional< StringRef > clang::tidy::ClangTidyCheck::OptionsView::getLocalOrGlobal | ( | StringRef | LocalName | ) | 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, return std::nullopt
.
Definition at line 85 of file ClangTidyCheck.cpp.
References clang::tidy::findPriorityOption(), and clang::tidy::ClangTidyContext::getOptionsCollector().
Referenced by getLocalOrGlobal().
|
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, return std::nullopt
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return std::nullopt
.
Definition at line 256 of file ClangTidyCheck.h.
References get(), and getLocalOrGlobal().
|
inline |
Read a named option from the Context
and parse it as an enum 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 std::nullopt
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return std::nullopt
.
clang::tidy::OptionEnumMapping must be specialized for T
to supply the mapping required to convert between T
and a string.
Definition at line 376 of file ClangTidyCheck.h.
|
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, return Default
. If the value value was found and equals none
, null
, -1
or empty, return std::nullopt
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
Definition at line 286 of file ClangTidyCheck.h.
References get(), and getLocalOrGlobal().
StringRef 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 230 of file ClangTidyCheck.cpp.
|
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, return Default
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
Definition at line 318 of file ClangTidyCheck.h.
|
inline |
Read a named option from the Context
and parse it as an enum 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 return Default
.
If the corresponding key can't be parsed as a T
, emit a diagnostic and return Default
.
clang::tidy::OptionEnumMapping must be specialized for T
to supply the mapping required to convert between T
and a string.
Definition at line 398 of file ClangTidyCheck.h.
void clang::tidy::ClangTidyCheck::OptionsView::store< bool > | ( | ClangTidyOptions::OptionMap & | Options, |
StringRef | LocalName, | ||
bool | Value | ||
) | const |
Stores an option with the check-local name LocalName
with bool value Value
to Options
.
Definition at line 149 of file ClangTidyCheck.cpp.
References clang::tidy::ClangTidyCheck::Options.
|
inline |
Stores an option with the check-local name LocalName
with integer value Value
to Options
.
If the value is empty stores ``
Definition at line 425 of file ClangTidyCheck.h.
References clang::tidy::ClangTidyCheck::Options, and store().
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 130 of file ClangTidyCheck.cpp.
References clang::tidy::ClangTidyCheck::Options.
Referenced by store(), clang::tidy::boost::UseRangesCheck::storeOptions(), clang::tidy::modernize::UseRangesCheck::storeOptions(), clang::tidy::utils::UseRangesCheck::storeOptions(), clang::tidy::abseil::StringFindStartswithCheck::storeOptions(), clang::tidy::abseil::StringFindStrContainsCheck::storeOptions(), clang::tidy::altera::SingleWorkItemBarrierCheck::storeOptions(), clang::tidy::altera::StructPackAlignCheck::storeOptions(), clang::tidy::android::ComparisonInTempFailureRetryCheck::storeOptions(), clang::tidy::bugprone::ArgumentCommentCheck::storeOptions(), clang::tidy::bugprone::AssertSideEffectCheck::storeOptions(), clang::tidy::bugprone::DanglingHandleCheck::storeOptions(), clang::tidy::bugprone::EasilySwappableParametersCheck::storeOptions(), clang::tidy::bugprone::EmptyCatchCheck::storeOptions(), clang::tidy::bugprone::ExceptionEscapeCheck::storeOptions(), clang::tidy::bugprone::ImplicitWideningOfMultiplicationResultCheck::storeOptions(), clang::tidy::bugprone::LambdaFunctionNameCheck::storeOptions(), clang::tidy::bugprone::MisplacedWideningCastCheck::storeOptions(), clang::tidy::bugprone::NonZeroEnumToBoolConversionCheck::storeOptions(), clang::tidy::bugprone::NotNullTerminatedResultCheck::storeOptions(), clang::tidy::bugprone::OptionalValueConversionCheck::storeOptions(), clang::tidy::bugprone::PointerArithmeticOnPolymorphicObjectCheck::storeOptions(), clang::tidy::bugprone::ReservedIdentifierCheck::storeOptions(), clang::tidy::bugprone::SignalHandlerCheck::storeOptions(), clang::tidy::bugprone::SignedCharMisuseCheck::storeOptions(), clang::tidy::bugprone::SizeofExpressionCheck::storeOptions(), clang::tidy::bugprone::StringConstructorCheck::storeOptions(), clang::tidy::bugprone::SuspiciousEnumUsageCheck::storeOptions(), clang::tidy::bugprone::SuspiciousMissingCommaCheck::storeOptions(), clang::tidy::bugprone::SuspiciousStringCompareCheck::storeOptions(), clang::tidy::bugprone::SuspiciousStringviewDataUsageCheck::storeOptions(), clang::tidy::bugprone::TaggedUnionMemberCountCheck::storeOptions(), clang::tidy::bugprone::TooSmallLoopVariableCheck::storeOptions(), clang::tidy::bugprone::UncheckedOptionalAccessCheck::storeOptions(), clang::tidy::bugprone::UnhandledSelfAssignmentCheck::storeOptions(), clang::tidy::bugprone::UnsafeFunctionsCheck::storeOptions(), clang::tidy::bugprone::UnusedLocalNonTrivialVariableCheck::storeOptions(), clang::tidy::cert::NonTrivialTypesLibcMemoryCallsCheck::storeOptions(), clang::tidy::cert::ProperlySeededRandomGeneratorCheck::storeOptions(), clang::tidy::concurrency::MtUnsafeCheck::storeOptions(), clang::tidy::cppcoreguidelines::AvoidDoWhileCheck::storeOptions(), clang::tidy::cppcoreguidelines::AvoidNonConstGlobalVariablesCheck::storeOptions(), clang::tidy::cppcoreguidelines::InitVariablesCheck::storeOptions(), clang::tidy::cppcoreguidelines::MacroUsageCheck::storeOptions(), clang::tidy::cppcoreguidelines::NarrowingConversionsCheck::storeOptions(), clang::tidy::cppcoreguidelines::NoMallocCheck::storeOptions(), clang::tidy::cppcoreguidelines::NoSuspendWithLockCheck::storeOptions(), clang::tidy::cppcoreguidelines::OwningMemoryCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProBoundsConstantArrayIndexCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProTypeConstCastCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProTypeMemberInitCheck::storeOptions(), clang::tidy::cppcoreguidelines::ProTypeStaticCastDowncastCheck::storeOptions(), clang::tidy::cppcoreguidelines::RvalueReferenceParamNotMovedCheck::storeOptions(), clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::storeOptions(), clang::tidy::google::runtime::IntegerTypesCheck::storeOptions(), clang::tidy::hicpp::IgnoredRemoveResultCheck::storeOptions(), clang::tidy::hicpp::MultiwayPathsCoveredCheck::storeOptions(), clang::tidy::hicpp::SignedBitwiseCheck::storeOptions(), clang::tidy::misc::ConstCorrectnessCheck::storeOptions(), clang::tidy::misc::CoroutineHostileRAIICheck::storeOptions(), clang::tidy::misc::HeaderIncludeCycleCheck::storeOptions(), clang::tidy::misc::IncludeCleanerCheck::storeOptions(), clang::tidy::misc::NonPrivateMemberVariablesInClassesCheck::storeOptions(), clang::tidy::misc::ThrowByValueCatchByReferenceCheck::storeOptions(), clang::tidy::misc::UniqueptrResetReleaseCheck::storeOptions(), clang::tidy::misc::UnusedParametersCheck::storeOptions(), clang::tidy::misc::UseInternalLinkageCheck::storeOptions(), clang::tidy::modernize::AvoidBindCheck::storeOptions(), clang::tidy::modernize::AvoidCArraysCheck::storeOptions(), clang::tidy::modernize::DeprecatedHeadersCheck::storeOptions(), clang::tidy::modernize::LoopConvertCheck::storeOptions(), clang::tidy::modernize::MakeSmartPtrCheck::storeOptions(), clang::tidy::modernize::MinMaxUseInitializerListCheck::storeOptions(), clang::tidy::modernize::PassByValueCheck::storeOptions(), clang::tidy::modernize::RawStringLiteralCheck::storeOptions(), clang::tidy::modernize::ReplaceAutoPtrCheck::storeOptions(), clang::tidy::modernize::ReplaceDisallowCopyAndAssignMacroCheck::storeOptions(), clang::tidy::modernize::ReplaceRandomShuffleCheck::storeOptions(), clang::tidy::modernize::TypeTraitsCheck::storeOptions(), clang::tidy::modernize::UseAutoCheck::storeOptions(), clang::tidy::modernize::UseBoolLiteralsCheck::storeOptions(), clang::tidy::modernize::UseDefaultMemberInitCheck::storeOptions(), clang::tidy::modernize::UseDesignatedInitializersCheck::storeOptions(), clang::tidy::modernize::UseEmplaceCheck::storeOptions(), clang::tidy::modernize::UseEqualsDefaultCheck::storeOptions(), clang::tidy::modernize::UseEqualsDeleteCheck::storeOptions(), clang::tidy::modernize::UseIntegerSignComparisonCheck::storeOptions(), clang::tidy::modernize::UseNodiscardCheck::storeOptions(), clang::tidy::modernize::UseNoexceptCheck::storeOptions(), clang::tidy::modernize::UseNullptrCheck::storeOptions(), clang::tidy::modernize::UseOverrideCheck::storeOptions(), clang::tidy::modernize::UseStdFormatCheck::storeOptions(), clang::tidy::modernize::UseStdNumbersCheck::storeOptions(), clang::tidy::modernize::UseStdPrintCheck::storeOptions(), clang::tidy::modernize::UseTransparentFunctorsCheck::storeOptions(), clang::tidy::modernize::UseUsingCheck::storeOptions(), clang::tidy::objc::ForbiddenSubclassingCheck::storeOptions(), clang::tidy::openmp::ExceptionEscapeCheck::storeOptions(), clang::tidy::performance::EnumSizeCheck::storeOptions(), clang::tidy::performance::FasterStringFindCheck::storeOptions(), clang::tidy::performance::ForRangeCopyCheck::storeOptions(), clang::tidy::performance::InefficientStringConcatenationCheck::storeOptions(), clang::tidy::performance::InefficientVectorOperationCheck::storeOptions(), clang::tidy::performance::MoveConstArgCheck::storeOptions(), clang::tidy::performance::NoAutomaticMoveCheck::storeOptions(), clang::tidy::performance::TypePromotionInMathFnCheck::storeOptions(), clang::tidy::performance::UnnecessaryCopyInitialization::storeOptions(), clang::tidy::performance::UnnecessaryValueParamCheck::storeOptions(), clang::tidy::portability::RestrictSystemIncludesCheck::storeOptions(), clang::tidy::portability::SIMDIntrinsicsCheck::storeOptions(), clang::tidy::readability::AvoidConstParamsInDecls::storeOptions(), clang::tidy::readability::BracesAroundStatementsCheck::storeOptions(), clang::tidy::readability::ConstReturnTypeCheck::storeOptions(), clang::tidy::readability::ContainerDataPointerCheck::storeOptions(), clang::tidy::readability::ContainerSizeEmptyCheck::storeOptions(), clang::tidy::readability::ElseAfterReturnCheck::storeOptions(), clang::tidy::readability::EnumInitialValueCheck::storeOptions(), clang::tidy::readability::FunctionCognitiveComplexityCheck::storeOptions(), clang::tidy::readability::FunctionSizeCheck::storeOptions(), clang::tidy::readability::IdentifierLengthCheck::storeOptions(), clang::tidy::readability::IdentifierNamingCheck::storeOptions(), clang::tidy::readability::ImplicitBoolConversionCheck::storeOptions(), clang::tidy::readability::InconsistentDeclarationParameterNameCheck::storeOptions(), clang::tidy::readability::MagicNumbersCheck::storeOptions(), clang::tidy::readability::OperatorsRepresentationCheck::storeOptions(), clang::tidy::readability::QualifiedAutoCheck::storeOptions(), clang::tidy::readability::RedundantCastingCheck::storeOptions(), clang::tidy::readability::RedundantDeclarationCheck::storeOptions(), clang::tidy::readability::RedundantMemberInitCheck::storeOptions(), clang::tidy::readability::RedundantSmartptrGetCheck::storeOptions(), clang::tidy::readability::RedundantStringInitCheck::storeOptions(), clang::tidy::readability::SimplifyBooleanExprCheck::storeOptions(), clang::tidy::readability::SimplifySubscriptExprCheck::storeOptions(), clang::tidy::readability::StaticAccessedThroughInstanceCheck::storeOptions(), clang::tidy::readability::StringCompareCheck::storeOptions(), clang::tidy::readability::SuspiciousCallArgumentCheck::storeOptions(), clang::tidy::readability::UniqueptrDeleteReleaseCheck::storeOptions(), clang::tidy::readability::UppercaseLiteralSuffixCheck::storeOptions(), clang::tidy::readability::UseStdMinMaxCheck::storeOptions(), clang::tidy::RenamerClangTidyCheck::storeOptions(), clang::tidy::utils::TransformerClangTidyCheck::storeOptions(), and clang::tidy::zircon::TemporaryObjectsCheck::storeOptions().
|
inline |
Stores an option with the check-local name LocalName
with integer value Value
to Options
.
Definition at line 412 of file ClangTidyCheck.h.
References clang::tidy::ClangTidyCheck::Options.
|
inline |
Stores an option with the check-local name LocalName
as the string representation of the Enum Value
to Options
.
clang::tidy::OptionEnumMapping must be specialized for T
to supply the mapping required to convert between T
and a string.
Definition at line 440 of file ClangTidyCheck.h.
References clang::tidy::OptionEnumMapping< T >::getEnumMapping(), clang::tidy::ClangTidyCheck::Options, and store().