Skip to content

Commit cc45f76

Browse files
author
git apple-llvm automerger
committed
Merge commit 'f73155cad217' from apple/master into swift/master-next
2 parents 465fb46 + f73155c commit cc45f76

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

llvm/lib/Support/YAMLParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,8 +2288,8 @@ Document::Document(Stream &S) : stream(S), Root(nullptr) {
22882288
bool Document::skip() {
22892289
if (stream.scanner->failed())
22902290
return false;
2291-
if (!Root)
2292-
getRoot();
2291+
if (!Root && !getRoot())
2292+
return false;
22932293
Root->skip();
22942294
Token &T = peekNext();
22952295
if (T.Kind == Token::TK_StreamEnd)

llvm/unittests/Support/YAMLParserTest.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,15 @@ TEST(YAMLParser, DifferentNodesIteratorOperatorEquals) {
331331
EXPECT_TRUE(End == AnotherEnd);
332332
}
333333

334+
TEST(YAMLParser, FlowSequenceTokensOutsideFlowSequence) {
335+
auto FlowSequenceStrs = {",", "]", "}"};
336+
SourceMgr SM;
337+
338+
for (auto &Str : FlowSequenceStrs) {
339+
yaml::Stream Stream(Str, SM);
340+
yaml::Document &Doc = *Stream.begin();
341+
EXPECT_FALSE(Doc.skip());
342+
}
343+
}
344+
334345
} // end namespace llvm

0 commit comments

Comments
 (0)