Update some language usage.

This CL updates a few bits of language to be inline with the Android
respectful code rules [1].

1- https://source.android.com/setup/contribute/respectful-code

Change-Id: Ia35b58d9003df64eeb1e9196c9c194f8955c11c1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25941
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-07-29 17:49:01 +00:00 committed by David Neto
parent d35e4e1bbe
commit bf4614e252
4 changed files with 31 additions and 31 deletions

View File

@ -630,7 +630,7 @@ ast::type::Type* FunctionEmitter::GetVariableStoreType(
bool FunctionEmitter::EmitBody() {
RegisterBasicBlocks();
if (!TerminatorsAreSane()) {
if (!TerminatorsAreValid()) {
return false;
}
if (!RegisterMerges()) {
@ -674,7 +674,7 @@ void FunctionEmitter::RegisterBasicBlocks() {
}
}
bool FunctionEmitter::TerminatorsAreSane() {
bool FunctionEmitter::TerminatorsAreValid() {
if (failed()) {
return false;
}
@ -1261,7 +1261,7 @@ bool FunctionEmitter::ClassifyCFGEdges() {
for (const auto dest : successors) {
const auto* dest_info = GetBlockInfo(dest);
// We've already checked terminators are sane.
// We've already checked terminators are valid.
assert(dest_info);
const auto dest_pos = dest_info->pos;

View File

@ -319,13 +319,13 @@ class FunctionEmitter {
/// Verifies that terminators only branch to labels in the current function.
/// Assumes basic blocks have been registered.
/// @returns true if terminators are sane
bool TerminatorsAreSane();
/// @returns true if terminators are valid
bool TerminatorsAreValid();
/// Populates merge-header cross-links and the |is_continue_entire_loop|
/// member of BlockInfo. Also verifies that merge instructions go to blocks
/// in the same function. Assumes basic blocks have been registered, and
/// terminators are sane.
/// terminators are valid.
/// @returns false if registration fails
bool RegisterMerges();
@ -346,7 +346,7 @@ class FunctionEmitter {
/// Labels each basic block with its nearest enclosing structured construct.
/// Populates the |construct| member of BlockInfo, and the |constructs_| list.
/// Assumes terminators are sane and merges have been registered, block
/// Assumes terminators are valid and merges have been registered, block
/// order has been computed, and each block is labeled with its position.
/// Checks nesting of structured control flow constructs.
/// @returns false if bad nesting has been detected

View File

@ -122,7 +122,7 @@ bool FlowFindIfSelectionInternalHeaders(FunctionEmitter* fe) {
return fe->FindIfSelectionInternalHeaders();
}
TEST_F(SpvParserTest, TerminatorsAreSane_SingleBlock) {
TEST_F(SpvParserTest, TerminatorsAreValid_SingleBlock) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -134,10 +134,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_SingleBlock) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_Sequence) {
TEST_F(SpvParserTest, TerminatorsAreValid_Sequence) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -152,10 +152,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Sequence) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane()) << p->error();
EXPECT_TRUE(fe.TerminatorsAreValid()) << p->error();
}
TEST_F(SpvParserTest, TerminatorsAreSane_If) {
TEST_F(SpvParserTest, TerminatorsAreValid_If) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -177,10 +177,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_If) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane()) << p->error();
EXPECT_TRUE(fe.TerminatorsAreValid()) << p->error();
}
TEST_F(SpvParserTest, TerminatorsAreSane_Switch) {
TEST_F(SpvParserTest, TerminatorsAreValid_Switch) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -205,10 +205,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Switch) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_Loop_SingleBlock) {
TEST_F(SpvParserTest, TerminatorsAreValid_Loop_SingleBlock) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -227,10 +227,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Loop_SingleBlock) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_Loop_Simple) {
TEST_F(SpvParserTest, TerminatorsAreValid_Loop_Simple) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -255,10 +255,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Loop_Simple) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_Kill) {
TEST_F(SpvParserTest, TerminatorsAreValid_Kill) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -270,10 +270,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Kill) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_Unreachable) {
TEST_F(SpvParserTest, TerminatorsAreValid_Unreachable) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -285,10 +285,10 @@ TEST_F(SpvParserTest, TerminatorsAreSane_Unreachable) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_TRUE(fe.TerminatorsAreSane());
EXPECT_TRUE(fe.TerminatorsAreValid());
}
TEST_F(SpvParserTest, TerminatorsAreSane_MissingTerminator) {
TEST_F(SpvParserTest, TerminatorsAreValid_MissingTerminator) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -300,7 +300,7 @@ TEST_F(SpvParserTest, TerminatorsAreSane_MissingTerminator) {
EXPECT_FALSE(p->BuildAndParseInternalModuleExceptFunctions());
}
TEST_F(SpvParserTest, TerminatorsAreSane_DisallowLoopToEntryBlock) {
TEST_F(SpvParserTest, TerminatorsAreValid_DisallowLoopToEntryBlock) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -315,11 +315,11 @@ TEST_F(SpvParserTest, TerminatorsAreSane_DisallowLoopToEntryBlock) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_FALSE(fe.TerminatorsAreSane());
EXPECT_FALSE(fe.TerminatorsAreValid());
EXPECT_THAT(p->error(), Eq("Block 20 branches to function entry block 10"));
}
TEST_F(SpvParserTest, TerminatorsAreSane_DisallowNonBlock) {
TEST_F(SpvParserTest, TerminatorsAreValid_DisallowNonBlock) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -331,13 +331,13 @@ TEST_F(SpvParserTest, TerminatorsAreSane_DisallowNonBlock) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_FALSE(fe.TerminatorsAreSane());
EXPECT_FALSE(fe.TerminatorsAreValid());
EXPECT_THAT(p->error(),
Eq("Block 10 in function 100 branches to 999 which is "
"not a block in the function"));
}
TEST_F(SpvParserTest, TerminatorsAreSane_DisallowBlockInDifferentFunction) {
TEST_F(SpvParserTest, TerminatorsAreValid_DisallowBlockInDifferentFunction) {
auto* p = parser(test::Assemble(CommonTypes() + R"(
%100 = OpFunction %void None %voidfn
@ -357,7 +357,7 @@ TEST_F(SpvParserTest, TerminatorsAreSane_DisallowBlockInDifferentFunction) {
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions()) << p->error();
FunctionEmitter fe(p, *spirv_function(100));
fe.RegisterBasicBlocks();
EXPECT_FALSE(fe.TerminatorsAreSane());
EXPECT_FALSE(fe.TerminatorsAreValid());
EXPECT_THAT(p->error(), Eq("Block 10 in function 100 branches to 210 which "
"is not a block in the function"));
}

View File

@ -55,7 +55,7 @@ using DecorationList = std::vector<Decoration>;
/// An AST expression with its type.
struct TypedExpression {
/// Dummy constructor
/// Constructor
TypedExpression();
/// Constructor
/// @param t the type