[clang] Inclusive language: change instances of blacklist/whitelist to allowlist/ignorelist

Change the error message to use ignorelist, and changed some variable and function
names in related code and test.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D113189
This commit is contained in:
Zarko Todorovski 2021-11-12 14:30:06 +00:00
parent 99d5cbbd7e
commit 05f34ffa21
5 changed files with 20 additions and 20 deletions

View File

@ -52,11 +52,11 @@ def Tr : Tag<"tr"> { let EndTagOptional = 1; }
def Th : Tag<"th"> { let EndTagOptional = 1; } def Th : Tag<"th"> { let EndTagOptional = 1; }
def Td : Tag<"td"> { let EndTagOptional = 1; } def Td : Tag<"td"> { let EndTagOptional = 1; }
// Define a blacklist of attributes that are not safe to pass through to HTML // Define a list of attributes that are not safe to pass through to HTML
// output if the input is untrusted. // output if the input is untrusted.
// //
// FIXME: this should be a whitelist. When changing this to a whitelist, don't // FIXME: This should be a list of attributes that _are_ safe. When changing
// forget to change the default in the TableGen backend. // this change, don't forget to change the default in the TableGen backend.
class Attribute<string spelling> { class Attribute<string spelling> {
string Spelling = spelling; string Spelling = spelling;
bit IsSafeToPassThrough = 1; bit IsSafeToPassThrough = 1;

View File

@ -567,8 +567,8 @@ def remark_sanitize_address_insert_extra_padding_accepted : Remark<
def remark_sanitize_address_insert_extra_padding_rejected : Remark< def remark_sanitize_address_insert_extra_padding_rejected : Remark<
"-fsanitize-address-field-padding ignored for %0 because it " "-fsanitize-address-field-padding ignored for %0 because it "
"%select{is not C++|is packed|is a union|is trivially copyable|" "%select{is not C++|is packed|is a union|is trivially copyable|"
"has trivial destructor|is standard layout|is in a blacklisted file|" "has trivial destructor|is standard layout|is in a ignorelisted file|"
"is blacklisted}1">, ShowInSystemHeader, "is ignorelisted}1">, ShowInSystemHeader,
InGroup<SanitizeAddressRemarks>; InGroup<SanitizeAddressRemarks>;
def warn_npot_ms_struct : Warning< def warn_npot_ms_struct : Warning<

View File

@ -4621,7 +4621,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// reject options that shouldn't be supported in bitcode // reject options that shouldn't be supported in bitcode
// also reject kernel/kext // also reject kernel/kext
static const constexpr unsigned kBitcodeOptionBlacklist[] = { static const constexpr unsigned kBitcodeOptionIgnorelist[] = {
options::OPT_mkernel, options::OPT_mkernel,
options::OPT_fapple_kext, options::OPT_fapple_kext,
options::OPT_ffunction_sections, options::OPT_ffunction_sections,
@ -4665,7 +4665,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_mllvm, options::OPT_mllvm,
}; };
for (const auto &A : Args) for (const auto &A : Args)
if (llvm::is_contained(kBitcodeOptionBlacklist, A->getOption().getID())) if (llvm::is_contained(kBitcodeOptionIgnorelist, A->getOption().getID()))
D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling(); D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling();
// Render the CodeGen options that need to be passed. // Render the CodeGen options that need to be passed.

View File

@ -119,7 +119,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor &PP,
// Print header info for extra headers, pretending they were discovered by // Print header info for extra headers, pretending they were discovered by
// the regular preprocessor. The primary use case is to support proper // the regular preprocessor. The primary use case is to support proper
// generation of Make / Ninja file dependencies for implicit includes, such // generation of Make / Ninja file dependencies for implicit includes, such
// as sanitizer blacklists. It's only important for cl.exe compatibility, // as sanitizer ignorelists. It's only important for cl.exe compatibility,
// the GNU way to generate rules is -M / -MM / -MD / -MMD. // the GNU way to generate rules is -M / -MM / -MD / -MMD.
for (const auto &Header : DepOpts.ExtraDeps) for (const auto &Header : DepOpts.ExtraDeps)
PrintHeaderInfo(OutputFile, Header.first, ShowDepth, 2, MSStyle); PrintHeaderInfo(OutputFile, Header.first, ShowDepth, 2, MSStyle);

View File

@ -1,9 +1,9 @@
// Test -fsanitize-address-field-padding // Test -fsanitize-address-field-padding
// RUN: echo 'type:SomeNamespace::BlacklistedByName=field-padding' > %t.type.blacklist // RUN: echo 'type:SomeNamespace::IgnorelistedByName=field-padding' > %t.type.ignorelist
// RUN: echo 'src:*sanitize-address-field-padding.cpp=field-padding' > %t.file.blacklist // RUN: echo 'src:*sanitize-address-field-padding.cpp=field-padding' > %t.file.ignorelist
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.type.blacklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-ignorelist=%t.type.ignorelist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.type.blacklist -Rsanitize-address -emit-llvm -o - %s -O1 -fno-experimental-new-pass-manager -mconstructor-aliases 2>&1 | FileCheck %s --check-prefix=WITH_CTOR_ALIASES // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-ignorelist=%t.type.ignorelist -Rsanitize-address -emit-llvm -o - %s -O1 -fno-experimental-new-pass-manager -mconstructor-aliases 2>&1 | FileCheck %s --check-prefix=WITH_CTOR_ALIASES
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-blacklist=%t.file.blacklist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=FILE_BLACKLIST // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsanitize=address -fsanitize-address-field-padding=1 -fsanitize-ignorelist=%t.file.ignorelist -Rsanitize-address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=FILE_IGNORELIST
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=NO_PADDING // RUN: %clang_cc1 -fsanitize=address -emit-llvm -o - %s 2>&1 | FileCheck %s --check-prefix=NO_PADDING
// Try to emulate -save-temps option and make sure -disable-llvm-passes will not run sanitize instrumentation. // Try to emulate -save-temps option and make sure -disable-llvm-passes will not run sanitize instrumentation.
// RUN: %clang_cc1 -fsanitize=address -emit-llvm -disable-llvm-passes -o - %s | %clang_cc1 -fsanitize=address -emit-llvm -o - -x ir | FileCheck %s --check-prefix=NO_PADDING // RUN: %clang_cc1 -fsanitize=address -emit-llvm -disable-llvm-passes -o - %s | %clang_cc1 -fsanitize=address -emit-llvm -o - -x ir | FileCheck %s --check-prefix=NO_PADDING
@ -17,11 +17,11 @@
// CHECK: -fsanitize-address-field-padding ignored for Negative3 because it is a union // CHECK: -fsanitize-address-field-padding ignored for Negative3 because it is a union
// CHECK: -fsanitize-address-field-padding ignored for Negative4 because it is trivially copyable // CHECK: -fsanitize-address-field-padding ignored for Negative4 because it is trivially copyable
// CHECK: -fsanitize-address-field-padding ignored for Negative5 because it is packed // CHECK: -fsanitize-address-field-padding ignored for Negative5 because it is packed
// CHECK: -fsanitize-address-field-padding ignored for SomeNamespace::BlacklistedByName because it is blacklisted // CHECK: -fsanitize-address-field-padding ignored for SomeNamespace::IgnorelistedByName because it is ignorelisted
// CHECK: -fsanitize-address-field-padding ignored for ExternCStruct because it is not C++ // CHECK: -fsanitize-address-field-padding ignored for ExternCStruct because it is not C++
// //
// FILE_BLACKLIST: -fsanitize-address-field-padding ignored for Positive1 because it is in a blacklisted file // FILE_IGNORELIST: -fsanitize-address-field-padding ignored for Positive1 because it is in a ignorelisted file
// FILE_BLACKLIST-NOT: __asan_poison_intra_object_redzone // FILE_IGNORELIST-NOT: __asan_poison_intra_object_redzone
// NO_PADDING-NOT: __asan_poison_intra_object_redzone // NO_PADDING-NOT: __asan_poison_intra_object_redzone
@ -141,10 +141,10 @@ Negative5 negative5;
namespace SomeNamespace { namespace SomeNamespace {
class BlacklistedByName { class IgnorelistedByName {
public: public:
BlacklistedByName() {} IgnorelistedByName() {}
~BlacklistedByName() {} ~IgnorelistedByName() {}
int make_it_non_standard_layout; int make_it_non_standard_layout;
private: private:
char private1; char private1;
@ -152,7 +152,7 @@ class BlacklistedByName {
}; };
} // SomeNamespace } // SomeNamespace
SomeNamespace::BlacklistedByName blacklisted_by_name; SomeNamespace::IgnorelistedByName ignorelisted_by_name;
extern "C" { extern "C" {
class ExternCStruct { class ExternCStruct {