forked from OSchip/llvm-project
As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.
This commit is contained in:
parent
b6536e549d
commit
f92011d875
|
@ -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^".
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) ||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue