[clang-tools-extra] f92011d - As part of using inclusive language within the llvm project,

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 19 15:19:10 PDT 2020


Author: Eric Christopher
Date: 2020-06-19T15:12:18-07:00
New Revision: f92011d875cfdca1ed97bf0ab6956364c604b578

URL: https://github.com/llvm/llvm-project/commit/f92011d875cfdca1ed97bf0ab6956364c604b578
DIFF: https://github.com/llvm/llvm-project/commit/f92011d875cfdca1ed97bf0ab6956364c604b578.diff

LOG: As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.

Added: 
    

Modified: 
    clang-tools-extra/clangd/CodeComplete.cpp
    clang-tools-extra/clangd/Diagnostics.cpp
    clang-tools-extra/clangd/Hover.cpp
    clang-tools-extra/clangd/refactor/Rename.cpp
    clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
    clang-tools-extra/clangd/unittests/RenameTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp
index f69424c63be1..f79033ac9514 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 da554ff8c331..674fa0dbf9ec 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 1cc564be5cf5..2861d63d4d00 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<CharacterLiteral>(E) || llvm::isa<CompoundLiteralExpr>(E) ||
          llvm::isa<CXXBoolLiteralExpr>(E) ||
          llvm::isa<CXXNullPtrLiteralExpr>(E) ||

diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index c08f6ea805aa..ea75de6e86ea 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -98,10 +98,10 @@ llvm::DenseSet<const NamedDecl *> 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<ReasonToReject> 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 69bfe6731418..104f8ba63dd0 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<CompoundStmt>(Outer))
     return true;
   if (llvm::isa<SwitchCase>(Outer))

diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 56d562d3b15c..08af7aad0099 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 =


        


More information about the cfe-commits mailing list