diff --git a/common/BUILD b/common/BUILD index 8a0ff09c4de89..43122afce5771 100644 --- a/common/BUILD +++ b/common/BUILD @@ -24,7 +24,7 @@ cc_test( cc_library( name = "indirect_value", - srcs = ["indirect_value.h"], + hdrs = ["indirect_value.h"], ) cc_test( diff --git a/toolchain/lexer/string_literal_test.cpp b/toolchain/lexer/string_literal_test.cpp index 12db6b469bf1e..892d5288b7890 100644 --- a/toolchain/lexer/string_literal_test.cpp +++ b/toolchain/lexer/string_literal_test.cpp @@ -113,9 +113,6 @@ TEST_F(StringLiteralTest, StringLiteralBounds) { } TEST_F(StringLiteralTest, StringLiteralContents) { - // We use ""s strings to handle embedded nul characters below. - using std::operator""s; - std::pair testcases[] = { // Empty strings. {R"("")", ""}, diff --git a/toolchain/parser/BUILD b/toolchain/parser/BUILD index 49e9b2922e505..efdd8cd52314a 100644 --- a/toolchain/parser/BUILD +++ b/toolchain/parser/BUILD @@ -92,6 +92,7 @@ cc_library( srcs = ["precedence.cpp"], hdrs = ["precedence.h"], deps = [ + "//common:check", "//toolchain/lexer:token_kind", "@llvm-project//llvm:Support", ], diff --git a/toolchain/parser/precedence.cpp b/toolchain/parser/precedence.cpp index 18605b5acdac6..d50fedc49d32c 100644 --- a/toolchain/parser/precedence.cpp +++ b/toolchain/parser/precedence.cpp @@ -6,6 +6,8 @@ #include +#include "common/check.h" + namespace Carbon { namespace { @@ -120,9 +122,8 @@ struct OperatorPriorityTable { for (int8_t a = 0; a != NumPrecedenceLevels; ++a) { for (int8_t b = 0; b != NumPrecedenceLevels; ++b) { if (table[a][b] == OperatorPriority::LeftFirst) { - if (table[b][a] == OperatorPriority::LeftFirst) { - throw "inconsistent lookup table entries"; - } + CHECK(table[b][a] != OperatorPriority::LeftFirst) + << "inconsistent lookup table entries"; table[b][a] = OperatorPriority::RightFirst; } } @@ -164,16 +165,14 @@ struct OperatorPriorityTable { constexpr void ConsistencyCheck() { for (int8_t level = 0; level != NumPrecedenceLevels; ++level) { if (level != Highest) { - if (table[Highest][level] != OperatorPriority::LeftFirst || - table[level][Highest] != OperatorPriority::RightFirst) { - throw "Highest is not highest priority"; - } + CHECK(table[Highest][level] == OperatorPriority::LeftFirst && + table[level][Highest] == OperatorPriority::RightFirst) + << "Highest is not highest priority"; } if (level != Lowest) { - if (table[Lowest][level] != OperatorPriority::RightFirst || - table[level][Lowest] != OperatorPriority::LeftFirst) { - throw "Lowest is not lowest priority"; - } + CHECK(table[Lowest][level] == OperatorPriority::RightFirst && + table[level][Lowest] == OperatorPriority::LeftFirst) + << "Lowest is not lowest priority"; } } }