| Index: tools/gn/substitution_writer.cc
|
| diff --git a/tools/gn/substitution_writer.cc b/tools/gn/substitution_writer.cc
|
| index 4d818cdaeac6a25d45de131d93618909ac5a3379..cd74a521094dd091e2d94754a031ae0a5c7b284f 100644
|
| --- a/tools/gn/substitution_writer.cc
|
| +++ b/tools/gn/substitution_writer.cc
|
| @@ -169,15 +169,13 @@ void SubstitutionWriter::GetListAsSourceFiles(
|
| const SubstitutionList& list,
|
| std::vector<SourceFile>* output) {
|
| for (const auto& pattern : list.list()) {
|
| - CHECK(pattern.ranges().size() == 1 &&
|
| - pattern.ranges()[0].type == SUBSTITUTION_LITERAL)
|
| - << "The substitution pattern \""
|
| - << pattern.AsString()
|
| + LOG_IF(FATAL, pattern.ranges().size() != 1 ||
|
| + pattern.ranges()[0].type != SUBSTITUTION_LITERAL)
|
| + << "The substitution pattern \"" << pattern.AsString()
|
| << "\" was expected to be a literal with no {{substitutions}}.";
|
| const std::string& literal = pattern.ranges()[0].literal;
|
| - CHECK(literal.size() >= 1 && literal[0] == '/')
|
| - << "The result of the pattern \""
|
| - << pattern.AsString()
|
| + LOG_IF(FATAL, literal.empty() || literal[0] != '/')
|
| + << "The result of the pattern \"" << pattern.AsString()
|
| << "\" was not an absolute path.";
|
| output->push_back(SourceFile(literal));
|
| }
|
| @@ -201,9 +199,8 @@ SourceFile SubstitutionWriter::ApplyPatternToSource(
|
| const SourceFile& source) {
|
| std::string result_value = ApplyPatternToSourceAsString(
|
| settings, pattern, source);
|
| - CHECK(!result_value.empty() && result_value[0] == '/')
|
| - << "The result of the pattern \""
|
| - << pattern.AsString()
|
| + LOG_IF(FATAL, result_value.empty() || result_value[0] != '/')
|
| + << "The result of the pattern \"" << pattern.AsString()
|
| << "\" was not a path beginning in \"/\" or \"//\".";
|
| return SourceFile(SourceFile::SWAP_IN, &result_value);
|
| }
|
|
|