Author: Eric Christopher Date: 2020-06-20T15:20:11-07:00 New Revision: da6332f5f9f15f7b182f27bc9b8edbf709b48093
URL: https://github.com/llvm/llvm-project/commit/da6332f5f9f15f7b182f27bc9b8edbf709b48093 DIFF: https://github.com/llvm/llvm-project/commit/da6332f5f9f15f7b182f27bc9b8edbf709b48093.diff LOG: [clang-tidy] As part of using inclusive language within the llvm project, migrate away from the use of blacklist and whitelist. Added: Modified: clang-tools-extra/clang-tidy/google/NonConstReferences.cpp clang-tools-extra/clang-tidy/google/NonConstReferences.h clang-tools-extra/docs/clang-tidy/checks/google-runtime-references.rst clang-tools-extra/test/clang-tidy/checkers/google-runtime-references.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp b/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp index b7da1c5940c5..e0fb614dfe8b 100644 --- a/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp +++ b/clang-tools-extra/clang-tidy/google/NonConstReferences.cpp @@ -22,12 +22,12 @@ namespace runtime { NonConstReferences::NonConstReferences(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context), - WhiteListTypes( - utils::options::parseStringList(Options.get("WhiteListTypes", ""))) {} + IncludedTypes( + utils::options::parseStringList(Options.get("IncludedTypes", ""))) {} void NonConstReferences::storeOptions(ClangTidyOptions::OptionMap &Opts) { - Options.store(Opts, "WhiteListTypes", - utils::options::serializeStringList(WhiteListTypes)); + Options.store(Opts, "IncludedTypes", + utils::options::serializeStringList(IncludedTypes)); } void NonConstReferences::registerMatchers(MatchFinder *Finder) { @@ -67,12 +67,12 @@ void NonConstReferences::check(const MatchFinder::MatchResult &Result) { auto ReferencedType = *Result.Nodes.getNodeAs<QualType>("referenced_type"); - if (std::find_if(WhiteListTypes.begin(), WhiteListTypes.end(), - [&](llvm::StringRef WhiteListType) { + if (std::find_if(IncludedTypes.begin(), IncludedTypes.end(), + [&](llvm::StringRef ExplicitType) { return ReferencedType.getCanonicalType().getAsString( Result.Context->getPrintingPolicy()) == - WhiteListType; - }) != WhiteListTypes.end()) + ExplicitType; + }) != IncludedTypes.end()) return; // Don't warn on function references, they shouldn't be constant. diff --git a/clang-tools-extra/clang-tidy/google/NonConstReferences.h b/clang-tools-extra/clang-tidy/google/NonConstReferences.h index a8499a1982b1..ad7d4e4b1bca 100644 --- a/clang-tools-extra/clang-tidy/google/NonConstReferences.h +++ b/clang-tools-extra/clang-tidy/google/NonConstReferences.h @@ -30,7 +30,7 @@ class NonConstReferences : public ClangTidyCheck { void storeOptions(ClangTidyOptions::OptionMap &Opts) override; private: - const std::vector<std::string> WhiteListTypes; + const std::vector<std::string> IncludedTypes; }; } // namespace runtime diff --git a/clang-tools-extra/docs/clang-tidy/checks/google-runtime-references.rst b/clang-tools-extra/docs/clang-tidy/checks/google-runtime-references.rst index a210ccc1fb0b..52de1f108738 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/google-runtime-references.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/google-runtime-references.rst @@ -12,6 +12,6 @@ https://google.github.io/styleguide/cppguide.html#Reference_Arguments Options ------- -.. option:: WhiteListTypes +.. option:: IncludedTypes - A semicolon-separated list of names of whitelist types. Default is empty. + A semicolon-separated list of names of types to explicitly include. Default is empty. diff --git a/clang-tools-extra/test/clang-tidy/checkers/google-runtime-references.cpp b/clang-tools-extra/test/clang-tidy/checkers/google-runtime-references.cpp index 1ebbbe3fc86c..e70ec3aeddf0 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/google-runtime-references.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/google-runtime-references.cpp @@ -1,7 +1,7 @@ // RUN: %check_clang_tidy %s google-runtime-references %t -- \ // RUN: -config="{CheckOptions: \ -// RUN: [{key: google-runtime-references.WhiteListTypes, \ -// RUN: value: 'whitelist::A; whitelist::B'}]}" +// RUN: [{key: google-runtime-references.IncludedTypes, \ +// RUN: value: 'included::A; included::B'}]}" int a; int &b = a; @@ -141,14 +141,14 @@ A& operator|=(A& a, const A& b) { return a; } A& operator^=(A& a, const A& b) { return a; } A& operator&=(A& a, const A& b) { return a; } -namespace whitelist { +namespace included { class A {}; class B {}; void f7(A &); void f8(B &); } -void f9(whitelist::A &); -void f10(whitelist::B &); +void f9(included::A &); +void f10(included::B &); #define DEFINE_F(name) void name(int& a) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits