Skip to content

[clang-tidy] remove misuse of getLocalOrGlobal for non common used options #119948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "../ClangTidyCheck.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h"
#include <optional>

namespace clang::tidy::bugprone {

Expand All @@ -26,8 +25,7 @@ class UncheckedOptionalAccessCheck : public ClangTidyCheck {
public:
UncheckedOptionalAccessCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
ModelOptions{
Options.getLocalOrGlobal("IgnoreSmartPointerDereference", false)} {}
ModelOptions{Options.get("IgnoreSmartPointerDereference", false)} {}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ ProTypeMemberInitCheck::ProTypeMemberInitCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
IgnoreArrays(Options.get("IgnoreArrays", false)),
UseAssignment(Options.getLocalOrGlobal("UseAssignment", false)) {}
UseAssignment(Options.get("UseAssignment", false)) {}

void ProTypeMemberInitCheck::registerMatchers(MatchFinder *Finder) {
auto IsUserProvidedNonDelegatingConstructor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ void RvalueReferenceParamNotMovedCheck::check(
RvalueReferenceParamNotMovedCheck::RvalueReferenceParamNotMovedCheck(
StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
AllowPartialMove(Options.getLocalOrGlobal("AllowPartialMove", false)),
IgnoreUnnamedParams(
Options.getLocalOrGlobal("IgnoreUnnamedParams", false)),
AllowPartialMove(Options.get("AllowPartialMove", false)),
IgnoreUnnamedParams(Options.get("IgnoreUnnamedParams", false)),
IgnoreNonDeducedTemplateTypes(
Options.getLocalOrGlobal("IgnoreNonDeducedTemplateTypes", false)) {}
Options.get("IgnoreNonDeducedTemplateTypes", false)) {}

void RvalueReferenceParamNotMovedCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ InefficientVectorOperationCheck::InefficientVectorOperationCheck(
: ClangTidyCheck(Name, Context),
VectorLikeClasses(utils::options::parseStringList(
Options.get("VectorLikeClasses", "::std::vector"))),
EnableProto(Options.getLocalOrGlobal("EnableProto", false)) {}
EnableProto(Options.get("EnableProto", false)) {}

void InefficientVectorOperationCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class RedundantAccessSpecifiersCheck : public ClangTidyCheck {
public:
RedundantAccessSpecifiersCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
CheckFirstDeclaration(
Options.getLocalOrGlobal("CheckFirstDeclaration", false)) {}
CheckFirstDeclaration(Options.get("CheckFirstDeclaration", false)) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ RedundantCastingCheck::RedundantCastingCheck(StringRef Name,
ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)),
IgnoreTypeAliases(Options.getLocalOrGlobal("IgnoreTypeAliases", false)) {}
IgnoreTypeAliases(Options.get("IgnoreTypeAliases", false)) {}

void RedundantCastingCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "IgnoreMacros", IgnoreMacros);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ RenamerClangTidyCheck::RenamerClangTidyCheck(StringRef CheckName,
ClangTidyContext *Context)
: ClangTidyCheck(CheckName, Context),
AggressiveDependentMemberLookup(
Options.getLocalOrGlobal("AggressiveDependentMemberLookup", false)) {}
Options.get("AggressiveDependentMemberLookup", false)) {}
RenamerClangTidyCheck::~RenamerClangTidyCheck() = default;

void RenamerClangTidyCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Expand Down
Loading