Skip to content

Commit

Permalink
As part of using inclusive language within the llvm project,
Browse files Browse the repository at this point in the history
migrate away from the use of blacklist and whitelist.
  • Loading branch information
echristo committed Jun 19, 2020
1 parent b6536e5 commit f92011d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/CodeComplete.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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^".
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clangd/Diagnostics.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/Hover.cpp
Expand Up @@ -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) ||
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/refactor/Rename.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/unittests/RenameTests.cpp
Expand Up @@ -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 {};
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit f92011d

Please sign in to comment.