Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: tools/gn/substitution_writer.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698