diff --git a/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h index 9d45f5469725..7e4d260abb6b 100644 --- a/bolt/include/bolt/Profile/DataAggregator.h +++ b/bolt/include/bolt/Profile/DataAggregator.h @@ -311,6 +311,10 @@ private: /// Consume the entire line void consumeRestOfLine(); + /// True if the next token in the parsing buffer is a new line, but don't + /// consume it (peek only). + bool checkNewLine(); + /// Parse a single LBR entry as output by perf script -Fbrstack ErrorOr parseLBREntry(); diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index 215cf1b9d600..eb3e33b07bc8 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -1056,6 +1056,10 @@ void DataAggregator::consumeRestOfLine() { Line += 1; } +bool DataAggregator::checkNewLine() { + return ParsingBuf[0] == '\n'; +} + ErrorOr DataAggregator::parseBranchSample() { PerfBranchSample Res; @@ -2148,7 +2152,7 @@ DataAggregator::parseNameBuildIDPair() { // If one of the strings is missing, don't issue a parsing error, but still // do not return a value. consumeAllRemainingFS(); - if (checkAndConsumeNewLine()) + if (checkNewLine()) return NoneType(); ErrorOr NameStr = parseString(FieldSeparator, true);