From f92011d875cfdca1ed97bf0ab6956364c604b578 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 19 Jun 2020 15:05:26 -0700 Subject: [PATCH] As part of using inclusive language within the llvm project, migrate away from the use of blacklist and whitelist. --- clang-tools-extra/clangd/CodeComplete.cpp | 6 +++--- clang-tools-extra/clangd/Diagnostics.cpp | 4 ++-- clang-tools-extra/clangd/Hover.cpp | 2 +- clang-tools-extra/clangd/refactor/Rename.cpp | 6 +++--- .../clangd/refactor/tweaks/ExtractVariable.cpp | 2 +- clang-tools-extra/clangd/unittests/RenameTests.cpp | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index f69424c63be19..f79033ac95142 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -675,8 +675,8 @@ static bool isInjectedClass(const NamedDecl &D) { return false; } -// Some member calls are blacklisted because they're so rarely useful. -static bool isBlacklistedMember(const NamedDecl &D) { +// Some member calls are excluded because they're so rarely useful. +static bool isExcludedMember(const NamedDecl &D) { // Destructor completion is rarely useful, and works inconsistently. // (s.^ completes ~string, but s.~st^ is an error). if (D.getKind() == Decl::CXXDestructor) @@ -759,7 +759,7 @@ struct CompletionRecorder : public CodeCompleteConsumer { continue; if (Result.Declaration && !Context.getBaseType().isNull() // is this a member-access context? - && isBlacklistedMember(*Result.Declaration)) + && isExcludedMember(*Result.Declaration)) continue; // Skip injected class name when no class scope is not explicitly set. // E.g. show injected A::A in `using A::A^` but not in "A^". diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp index da554ff8c331c..674fa0dbf9ec9 100644 --- a/clang-tools-extra/clangd/Diagnostics.cpp +++ b/clang-tools-extra/clangd/Diagnostics.cpp @@ -76,7 +76,7 @@ bool mentionsMainFile(const Diag &D) { return false; } -bool isBlacklisted(const Diag &D) { +bool isExcluded(const Diag &D) { // clang will always fail parsing MS ASM, we don't link in desc + asm parser. if (D.ID == clang::diag::err_msasm_unable_to_create_target || D.ID == clang::diag::err_msasm_unsupported_arch) @@ -738,7 +738,7 @@ void StoreDiags::flushLastDiag() { LastDiag.reset(); }); - if (isBlacklisted(*LastDiag)) + if (isExcluded(*LastDiag)) return; // Move errors that occur from headers into main file. if (!LastDiag->InsideMainFile && LastDiagLoc && LastDiagOriginallyError) { diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp index 1cc564be5cf53..2861d63d4d008 100644 --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -580,7 +580,7 @@ HoverInfo getHoverContents(const DefinedMacro &Macro, ParsedAST &AST) { bool isLiteral(const Expr *E) { // Unfortunately there's no common base Literal classes inherits from - // (apart from Expr), therefore this is a nasty blacklist. + // (apart from Expr), therefore these exclusions. return llvm::isa(E) || llvm::isa(E) || llvm::isa(E) || llvm::isa(E) || diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp index c08f6ea805aaa..ea75de6e86eac 100644 --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -98,10 +98,10 @@ llvm::DenseSet locateDeclAt(ParsedAST &AST, return Result; } -// By default, we blacklist C++ standard symbols and protobuf symbols as rename +// By default, we exclude C++ standard symbols and protobuf symbols as rename // these symbols would change system/generated files which are unlikely to be // modified. -bool isBlacklisted(const NamedDecl &RenameDecl) { +bool isExcluded(const NamedDecl &RenameDecl) { if (isProtoFile(RenameDecl.getLocation(), RenameDecl.getASTContext().getSourceManager())) return true; @@ -138,7 +138,7 @@ llvm::Optional renameable(const NamedDecl &RenameDecl, if (RenameDecl.getParentFunctionOrMethod()) return None; - if (isBlacklisted(RenameDecl)) + if (isExcluded(RenameDecl)) return ReasonToReject::UnsupportedSymbol; // Check whether the symbol being rename is indexable. diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp index 69bfe67314185..104f8ba63dd04 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -339,7 +339,7 @@ const SelectionTree::Node *getCallExpr(const SelectionTree::Node *DeclRef) { bool childExprIsStmt(const Stmt *Outer, const Expr *Inner) { if (!Outer || !Inner) return false; - // Blacklist the most common places where an expr can appear but be unused. + // Exclude the most common places where an expr can appear but be unused. if (llvm::isa(Outer)) return true; if (llvm::isa(Outer)) diff --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp index 56d562d3b15c5..08af7aad0099f 100644 --- a/clang-tools-extra/clangd/unittests/RenameTests.cpp +++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -590,13 +590,13 @@ TEST(RenameTest, Renameable) { void fo^o() {})cpp", "used outside main file", !HeaderFile, nullptr /*no index*/}, - {R"cpp(// disallow rename on blacklisted symbols (e.g. std symbols) + {R"cpp(// disallow rename on excluded symbols (e.g. std symbols) namespace std { class str^ing {}; } )cpp", "not a supported kind", !HeaderFile, Index}, - {R"cpp(// disallow rename on blacklisted symbols (e.g. std symbols) + {R"cpp(// disallow rename on excluded symbols (e.g. std symbols) namespace std { inline namespace __u { class str^ing {}; @@ -688,7 +688,7 @@ TEST(RenameTest, MainFileReferencesOnly) { expectedResult(Code, NewName)); } -TEST(RenameTest, ProtobufSymbolIsBlacklisted) { +TEST(RenameTest, ProtobufSymbolIsExcluded) { Annotations Code("Prot^obuf buf;"); auto TU = TestTU::withCode(Code.code()); TU.HeaderCode =