diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-28 21:38:52 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-11-28 21:38:52 +0000 |
commit | 3ab3fef2f17e35f1ab2a9bc6e28ddbc3fae27703 (patch) | |
tree | 1377eaeeba4531d4dccc572f9fad77b53f0ad2e9 /llvm/unittests | |
parent | ce3c8ef26e0ab8148a57810263bf3120fc6f4200 (diff) | |
download | bcm5719-llvm-3ab3fef2f17e35f1ab2a9bc6e28ddbc3fae27703.tar.gz bcm5719-llvm-3ab3fef2f17e35f1ab2a9bc6e28ddbc3fae27703.zip |
Improve error handling in YAML parsing
Some scanner errors were not checked and reported by the parser.
Fix PR30934. Recommit r288014 after fixing unittest.
Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>
Differential Revision: https://reviews.llvm.org/D26419
llvm-svn: 288071
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Support/YAMLIOTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp index bf70e749b4f..c3e18d33235 100644 --- a/llvm/unittests/Support/YAMLIOTest.cpp +++ b/llvm/unittests/Support/YAMLIOTest.cpp @@ -2368,3 +2368,11 @@ TEST(YAMLIO, TestMapWithContext) { out); out.clear(); } + +TEST(YAMLIO, InvalidInput) { + // polluting 1 value in the sequence + Input yin("---\n- foo: 3\n bar: 5\n1\n- foo: 3\n bar: 5\n...\n"); + std::vector<FooBar> Data; + yin >> Data; + EXPECT_TRUE((bool)yin.error()); +} |