[PATCH] D91462: [YAMLIO] Correctly diagnose empty alias/anchor
Scott Linder via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 16 10:45:45 PST 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb877c35d4b2c: [YAMLIO] Correctly diagnose empty alias/anchor (authored by scott.linder).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91462/new/
https://reviews.llvm.org/D91462
Files:
llvm/lib/Support/YAMLParser.cpp
llvm/unittests/Support/YAMLIOTest.cpp
Index: llvm/unittests/Support/YAMLIOTest.cpp
===================================================================
--- llvm/unittests/Support/YAMLIOTest.cpp
+++ llvm/unittests/Support/YAMLIOTest.cpp
@@ -3101,3 +3101,15 @@
EXPECT_FALSE(yin2.setCurrentDocument());
EXPECT_TRUE(yin2.error());
}
+
+TEST(YAMLIO, TestEmptyAlias) {
+ Input yin("&");
+ EXPECT_FALSE(yin.setCurrentDocument());
+ EXPECT_TRUE(yin.error());
+}
+
+TEST(YAMLIO, TestEmptyAnchor) {
+ Input yin("*");
+ EXPECT_FALSE(yin.setCurrentDocument());
+ EXPECT_TRUE(yin.error());
+}
Index: llvm/lib/Support/YAMLParser.cpp
===================================================================
--- llvm/lib/Support/YAMLParser.cpp
+++ llvm/lib/Support/YAMLParser.cpp
@@ -1423,7 +1423,7 @@
++Column;
}
- if (Start == Current) {
+ if (Start + 1 == Current) {
setError("Got empty alias or anchor", Start);
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91462.305558.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201116/de54beba/attachment.bin>
More information about the llvm-commits
mailing list