diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -2144,6 +2144,8 @@ if (std::error_code EC = BuildIDStr.getError()) return NoneType(); + consumeAllRemainingFS(); + // If one of the strings is missing, don't issue a parsing error, but still // do not return a value. if (ParsingBuf[0] == '\n') diff --git a/bolt/unittests/Profile/DataAggregator.cpp b/bolt/unittests/Profile/DataAggregator.cpp --- a/bolt/unittests/Profile/DataAggregator.cpp +++ b/bolt/unittests/Profile/DataAggregator.cpp @@ -41,11 +41,14 @@ StringRef AllValidBuildIDs = "0000 File0\n" "1111 File1\n" - "2222 File2\n"; + "2222 File2\n" + "333 File3\n"; DA.setParsingBuffer(AllValidBuildIDs); ASSERT_TRUE(DA.hasAllBuildIDs()); FileName = DA.getFileNameForBuildID("1234"); ASSERT_FALSE(FileName); FileName = DA.getFileNameForBuildID("2222"); ASSERT_EQ(*FileName, "File2"); + FileName = DA.getFileNameForBuildID("333"); + ASSERT_EQ(*FileName, "File3"); }