Update access control lists. (#3433)
This CL updates the access control lists used in SPIRV-Tools to the more
descriptive allow/deny naming.
diff --git a/source/operand.cpp b/source/operand.cpp
index 755ad6a..0910595 100644
--- a/source/operand.cpp
+++ b/source/operand.cpp
@@ -455,7 +455,7 @@
return false;
}
switch (type) {
- // Blacklist non-input IDs.
+ // Deny non-input IDs.
case SPV_OPERAND_TYPE_TYPE_ID:
case SPV_OPERAND_TYPE_RESULT_ID:
return false;
diff --git a/source/opt/aggressive_dead_code_elim_pass.cpp b/source/opt/aggressive_dead_code_elim_pass.cpp
index db2b67b..760d8e8 100644
--- a/source/opt/aggressive_dead_code_elim_pass.cpp
+++ b/source/opt/aggressive_dead_code_elim_pass.cpp
@@ -131,11 +131,11 @@
}
bool AggressiveDCEPass::AllExtensionsSupported() const {
- // If any extension not in whitelist, return false
+ // If any extension not in allowlist, return false
for (auto& ei : get_module()->extensions()) {
const char* extName =
reinterpret_cast<const char*>(&ei.GetInOperand(0).words[0]);
- if (extensions_whitelist_.find(extName) == extensions_whitelist_.end())
+ if (extensions_allowlist_.find(extName) == extensions_allowlist_.end())
return false;
}
return true;
@@ -882,14 +882,14 @@
AggressiveDCEPass::AggressiveDCEPass() = default;
Pass::Status AggressiveDCEPass::Process() {
- // Initialize extensions whitelist
+ // Initialize extensions allowlist
InitExtensions();
return ProcessImpl();
}
void AggressiveDCEPass::InitExtensions() {
- extensions_whitelist_.clear();
- extensions_whitelist_.insert({
+ extensions_allowlist_.clear();
+ extensions_allowlist_.insert({
"SPV_AMD_shader_explicit_vertex_parameter",
"SPV_AMD_shader_trinary_minmax",
"SPV_AMD_gcn_shader",
diff --git a/source/opt/aggressive_dead_code_elim_pass.h b/source/opt/aggressive_dead_code_elim_pass.h
index c043a96..131e33a 100644
--- a/source/opt/aggressive_dead_code_elim_pass.h
+++ b/source/opt/aggressive_dead_code_elim_pass.h
@@ -87,7 +87,7 @@
// to the live instruction worklist.
void AddStores(uint32_t ptrId);
- // Initialize extensions whitelist
+ // Initialize extensions allowlist
void InitExtensions();
// Return true if all extensions in this module are supported by this pass.
@@ -191,7 +191,7 @@
std::vector<Instruction*> to_kill_;
// Extensions supported by this pass.
- std::unordered_set<std::string> extensions_whitelist_;
+ std::unordered_set<std::string> extensions_allowlist_;
};
} // namespace opt
diff --git a/source/opt/local_access_chain_convert_pass.cpp b/source/opt/local_access_chain_convert_pass.cpp
index 0afe798..05704c1 100644
--- a/source/opt/local_access_chain_convert_pass.cpp
+++ b/source/opt/local_access_chain_convert_pass.cpp
@@ -281,7 +281,7 @@
// Initialize collections
supported_ref_ptrs_.clear();
- // Initialize extension whitelist
+ // Initialize extension allowlist
InitExtensions();
}
@@ -292,11 +292,11 @@
if (context()->get_feature_mgr()->HasCapability(
SpvCapabilityVariablePointers))
return false;
- // If any extension not in whitelist, return false
+ // If any extension not in allowlist, return false
for (auto& ei : get_module()->extensions()) {
const char* extName =
reinterpret_cast<const char*>(&ei.GetInOperand(0).words[0]);
- if (extensions_whitelist_.find(extName) == extensions_whitelist_.end())
+ if (extensions_allowlist_.find(extName) == extensions_allowlist_.end())
return false;
}
return true;
@@ -336,8 +336,8 @@
}
void LocalAccessChainConvertPass::InitExtensions() {
- extensions_whitelist_.clear();
- extensions_whitelist_.insert({
+ extensions_allowlist_.clear();
+ extensions_allowlist_.insert({
"SPV_AMD_shader_explicit_vertex_parameter",
"SPV_AMD_shader_trinary_minmax",
"SPV_AMD_gcn_shader",
diff --git a/source/opt/local_access_chain_convert_pass.h b/source/opt/local_access_chain_convert_pass.h
index e3592bf..552062e 100644
--- a/source/opt/local_access_chain_convert_pass.h
+++ b/source/opt/local_access_chain_convert_pass.h
@@ -110,7 +110,7 @@
// Returns a status to indicate success or failure, and change or no change.
Status ConvertLocalAccessChains(Function* func);
- // Initialize extensions whitelist
+ // Initialize extensions allowlist
void InitExtensions();
// Return true if all extensions in this module are allowed by this pass.
@@ -124,7 +124,7 @@
std::unordered_set<uint32_t> supported_ref_ptrs_;
// Extensions supported by this pass.
- std::unordered_set<std::string> extensions_whitelist_;
+ std::unordered_set<std::string> extensions_allowlist_;
};
} // namespace opt
diff --git a/source/opt/local_single_block_elim_pass.cpp b/source/opt/local_single_block_elim_pass.cpp
index b5435bb..401dad8 100644
--- a/source/opt/local_single_block_elim_pass.cpp
+++ b/source/opt/local_single_block_elim_pass.cpp
@@ -168,16 +168,16 @@
// Clear collections
supported_ref_ptrs_.clear();
- // Initialize extensions whitelist
+ // Initialize extensions allowlist
InitExtensions();
}
bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const {
- // If any extension not in whitelist, return false
+ // If any extension not in allowlist, return false
for (auto& ei : get_module()->extensions()) {
const char* extName =
reinterpret_cast<const char*>(&ei.GetInOperand(0).words[0]);
- if (extensions_whitelist_.find(extName) == extensions_whitelist_.end())
+ if (extensions_allowlist_.find(extName) == extensions_allowlist_.end())
return false;
}
return true;
@@ -214,8 +214,8 @@
}
void LocalSingleBlockLoadStoreElimPass::InitExtensions() {
- extensions_whitelist_.clear();
- extensions_whitelist_.insert({
+ extensions_allowlist_.clear();
+ extensions_allowlist_.insert({
"SPV_AMD_shader_explicit_vertex_parameter",
"SPV_AMD_shader_trinary_minmax",
"SPV_AMD_gcn_shader",
diff --git a/source/opt/local_single_block_elim_pass.h b/source/opt/local_single_block_elim_pass.h
index 0fe7732..ea72816 100644
--- a/source/opt/local_single_block_elim_pass.h
+++ b/source/opt/local_single_block_elim_pass.h
@@ -63,7 +63,7 @@
// where possible. Assumes logical addressing.
bool LocalSingleBlockLoadStoreElim(Function* func);
- // Initialize extensions whitelist
+ // Initialize extensions allowlist
void InitExtensions();
// Return true if all extensions in this module are supported by this pass.
@@ -94,7 +94,7 @@
std::unordered_set<uint32_t> pinned_vars_;
// Extensions supported by this pass.
- std::unordered_set<std::string> extensions_whitelist_;
+ std::unordered_set<std::string> extensions_allowlist_;
// Variables that are only referenced by supported operations for this
// pass ie. loads and stores.
diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp
index 4c71ce1..3f61853 100644
--- a/source/opt/local_single_store_elim_pass.cpp
+++ b/source/opt/local_single_store_elim_pass.cpp
@@ -46,11 +46,11 @@
}
bool LocalSingleStoreElimPass::AllExtensionsSupported() const {
- // If any extension not in whitelist, return false
+ // If any extension not in allowlist, return false
for (auto& ei : get_module()->extensions()) {
const char* extName =
reinterpret_cast<const char*>(&ei.GetInOperand(0).words[0]);
- if (extensions_whitelist_.find(extName) == extensions_whitelist_.end())
+ if (extensions_allowlist_.find(extName) == extensions_allowlist_.end())
return false;
}
return true;
@@ -74,12 +74,12 @@
LocalSingleStoreElimPass::LocalSingleStoreElimPass() = default;
Pass::Status LocalSingleStoreElimPass::Process() {
- InitExtensionWhiteList();
+ InitExtensionAllowList();
return ProcessImpl();
}
-void LocalSingleStoreElimPass::InitExtensionWhiteList() {
- extensions_whitelist_.insert({
+void LocalSingleStoreElimPass::InitExtensionAllowList() {
+ extensions_allowlist_.insert({
"SPV_AMD_shader_explicit_vertex_parameter",
"SPV_AMD_shader_trinary_minmax",
"SPV_AMD_gcn_shader",
diff --git a/source/opt/local_single_store_elim_pass.h b/source/opt/local_single_store_elim_pass.h
index 4cf8bbb..a7cdd19 100644
--- a/source/opt/local_single_store_elim_pass.h
+++ b/source/opt/local_single_store_elim_pass.h
@@ -57,8 +57,8 @@
// any resulting dead code.
bool LocalSingleStoreElim(Function* func);
- // Initialize extensions whitelist
- void InitExtensionWhiteList();
+ // Initialize extensions allowlist
+ void InitExtensionAllowList();
// Return true if all extensions in this module are allowed by this pass.
bool AllExtensionsSupported() const;
@@ -94,7 +94,7 @@
const std::vector<Instruction*>& uses);
// Extensions supported by this pass.
- std::unordered_set<std::string> extensions_whitelist_;
+ std::unordered_set<std::string> extensions_allowlist_;
};
} // namespace opt
diff --git a/test/opt/aggressive_dead_code_elim_test.cpp b/test/opt/aggressive_dead_code_elim_test.cpp
index e7303ba..a13ccbb 100644
--- a/test/opt/aggressive_dead_code_elim_test.cpp
+++ b/test/opt/aggressive_dead_code_elim_test.cpp
@@ -413,7 +413,7 @@
predefs1 + names_after + predefs2 + func_after, true, true);
}
-TEST_F(AggressiveDCETest, OptWhitelistExtension) {
+TEST_F(AggressiveDCETest, OptAllowListExtension) {
// #version 140
//
// in vec4 BaseColor;
@@ -498,7 +498,7 @@
predefs1 + names_after + predefs2 + func_after, true, true);
}
-TEST_F(AggressiveDCETest, NoOptBlacklistExtension) {
+TEST_F(AggressiveDCETest, NoOptDenyListExtension) {
// #version 140
//
// in vec4 BaseColor;
diff --git a/test/val/val_builtins_test.cpp b/test/val/val_builtins_test.cpp
index 58593dc..730986c 100644
--- a/test/val/val_builtins_test.cpp
+++ b/test/val/val_builtins_test.cpp
@@ -1952,7 +1952,7 @@
"needs to be a 32-bit int", "is not an int"))));
INSTANTIATE_TEST_SUITE_P(
- WhitelistRejection,
+ AllowListRejection,
ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult,
Combine(Values("PointSize", "ClipDistance", "CullDistance", "VertexId",
"InstanceId", "PointCoord", "SampleMask", "HelperInvocation",
@@ -2979,7 +2979,7 @@
TEST_F(ValidateBuiltIns, ValidBuiltinsForMeshShader) {
CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
generator.capabilities_ += R"(
-OpCapability MeshShadingNV
+OpCapability MeshShadingNV
)";
generator.extensions_ = R"(
@@ -3017,7 +3017,7 @@
TEST_F(ValidateBuiltIns, InvalidBuiltinsForMeshShader) {
CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator();
generator.capabilities_ += R"(
-OpCapability MeshShadingNV
+OpCapability MeshShadingNV
)";
generator.extensions_ = R"(
diff --git a/test/val/val_decoration_test.cpp b/test/val/val_decoration_test.cpp
index 204f468..b50c4ad 100644
--- a/test/val/val_decoration_test.cpp
+++ b/test/val/val_decoration_test.cpp
@@ -6353,7 +6353,7 @@
"requires one of these capabilities"))));
INSTANTIATE_TEST_SUITE_P(
- DecorationWhitelistFailure, ValidateWebGPUCombineDecorationResult,
+ DecorationAllowListFailure, ValidateWebGPUCombineDecorationResult,
Combine(Values("RelaxedPrecision", "BufferBlock", "GLSLShared",
"GLSLPacked", "Invariant", "Volatile", "Coherent"),
Values(TestResult(
diff --git a/test/val/val_modes_test.cpp b/test/val/val_modes_test.cpp
index 688f433..0a1476e 100644
--- a/test/val/val_modes_test.cpp
+++ b/test/val/val_modes_test.cpp
@@ -714,14 +714,14 @@
"SubgroupsPerWorkgroup 1", "SubgroupsPerWorkgroupId %int1"),
Values(SPV_ENV_UNIVERSAL_1_3)));
-INSTANTIATE_TEST_SUITE_P(ValidateModeGLComputeWebGPUWhitelistGood,
+INSTANTIATE_TEST_SUITE_P(ValidateModeGLComputeWebGPUAllowListGood,
ValidateModeExecution,
Combine(Values(SPV_SUCCESS), Values(""),
Values("GLCompute"), Values("LocalSize 1 1 1"),
Values(SPV_ENV_WEBGPU_0)));
INSTANTIATE_TEST_SUITE_P(
- ValidateModeGLComputeWebGPUWhitelistBad, ValidateModeExecution,
+ ValidateModeGLComputeWebGPUAllowListBad, ValidateModeExecution,
Combine(Values(SPV_ERROR_INVALID_DATA),
Values("Execution mode must be one of OriginUpperLeft, "
"DepthReplacing, DepthGreater, DepthLess, DepthUnchanged, "
@@ -730,14 +730,14 @@
Values(SPV_ENV_WEBGPU_0)));
INSTANTIATE_TEST_SUITE_P(
- ValidateModeFragmentWebGPUWhitelistGood, ValidateModeExecution,
+ ValidateModeFragmentWebGPUAllowListGood, ValidateModeExecution,
Combine(Values(SPV_SUCCESS), Values(""), Values("Fragment"),
Values("OriginUpperLeft", "DepthReplacing", "DepthGreater",
"DepthLess", "DepthUnchanged"),
Values(SPV_ENV_WEBGPU_0)));
INSTANTIATE_TEST_SUITE_P(
- ValidateModeFragmentWebGPUWhitelistBad, ValidateModeExecution,
+ ValidateModeFragmentWebGPUAllowListBad, ValidateModeExecution,
Combine(Values(SPV_ERROR_INVALID_DATA),
Values("Execution mode must be one of OriginUpperLeft, "
"DepthReplacing, DepthGreater, DepthLess, DepthUnchanged, "
diff --git a/test/val/val_webgpu_test.cpp b/test/val/val_webgpu_test.cpp
index e81fc7c..bca156b 100644
--- a/test/val/val_webgpu_test.cpp
+++ b/test/val/val_webgpu_test.cpp
@@ -254,7 +254,7 @@
"environment.\n OpMemoryModel Logical GLSL450\n"));
}
-TEST_F(ValidateWebGPU, WhitelistedExtendedInstructionsImportGood) {
+TEST_F(ValidateWebGPU, AllowListedExtendedInstructionsImportGood) {
std::string spirv = R"(
OpCapability Shader
OpCapability VulkanMemoryModelKHR
@@ -275,7 +275,7 @@
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_WEBGPU_0));
}
-TEST_F(ValidateWebGPU, NonWhitelistedExtendedInstructionsImportBad) {
+TEST_F(ValidateWebGPU, NonAllowListedExtendedInstructionsImportBad) {
std::string spirv = R"(
OpCapability Shader
OpCapability VulkanMemoryModelKHR
diff --git a/utils/check_symbol_exports.py b/utils/check_symbol_exports.py
index e14c2eb..bcd77da 100755
--- a/utils/check_symbol_exports.py
+++ b/utils/check_symbol_exports.py
@@ -55,11 +55,11 @@
# _Z[0-9]+spv[A-Z_] : C++ symbol starting with spv[A-Z_]
symbol_ok_pattern = re.compile(r'^(spv[A-Z]|_ZN|_Z[0-9]+spv[A-Z_])')
- # In addition, the following pattern whitelists global functions that are added
+ # In addition, the following pattern allowlists global functions that are added
# by the protobuf compiler:
# - AddDescriptors_spvtoolsfuzz_2eproto()
# - InitDefaults_spvtoolsfuzz_2eproto()
- symbol_whitelist_pattern = re.compile(r'_Z[0-9]+(InitDefaults|AddDescriptors)_spvtoolsfuzz_2eprotov')
+ symbol_allowlist_pattern = re.compile(r'_Z[0-9]+(InitDefaults|AddDescriptors)_spvtoolsfuzz_2eprotov')
seen = set()
result = 0
@@ -70,7 +70,7 @@
if symbol not in seen:
seen.add(symbol)
#print("look at '{}'".format(symbol))
- if not (symbol_whitelist_pattern.match(symbol) or symbol_ok_pattern.match(symbol)):
+ if not (symbol_allowlist_pattern.match(symbol) or symbol_ok_pattern.match(symbol)):
print('{}: error: Unescaped exported symbol: {}'.format(PROG, symbol))
result = 1
return result