From d380c38e3470c5b02a3002a7ea8d836f44086b31 Mon Sep 17 00:00:00 2001 From: Nathan James Date: Fri, 11 Dec 2020 16:34:06 +0000 Subject: [YAML] Use correct source location for unknown key errors. Currently unknown keys when inputting mapping traits have the location set to the Value. Example: ``` YAML:1:14: error: unknown key 'UnknownKey' {UnknownKey: SomeValue} ^~~~~~~~~ ``` This is unhelpful for a user as it draws them to fix the wrong item. Reviewed By: silvas Differential Revision: https://reviews.llvm.org/D93037 --- llvm/unittests/TextAPI/TextStubV1Tests.cpp | 4 ++-- llvm/unittests/TextAPI/TextStubV2Tests.cpp | 4 ++-- llvm/unittests/TextAPI/TextStubV3Tests.cpp | 4 ++-- llvm/unittests/TextAPI/TextStubV4Tests.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'llvm/unittests/TextAPI') diff --git a/llvm/unittests/TextAPI/TextStubV1Tests.cpp b/llvm/unittests/TextAPI/TextStubV1Tests.cpp index ea49ac4..64b9769 100644 --- a/llvm/unittests/TextAPI/TextStubV1Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV1Tests.cpp @@ -451,8 +451,8 @@ TEST(TBDv1, MalformedFile2) { EXPECT_FALSE(!!Result); std::string ErrorMessage = toString(Result.takeError()); ASSERT_EQ( - "malformed file\nTest.tbd:5:9: error: unknown key 'foobar'\nfoobar: " - "\"Unsupported key\"\n ^~~~~~~~~~~~~~~~~\n", + "malformed file\nTest.tbd:5:1: error: unknown key 'foobar'\nfoobar: " + "\"Unsupported key\"\n^~~~~~\n", ErrorMessage); } diff --git a/llvm/unittests/TextAPI/TextStubV2Tests.cpp b/llvm/unittests/TextAPI/TextStubV2Tests.cpp index 71d4397..c9e54ac 100644 --- a/llvm/unittests/TextAPI/TextStubV2Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV2Tests.cpp @@ -486,8 +486,8 @@ TEST(TBDv2, MalformedFile2) { EXPECT_FALSE(!!Result); std::string ErrorMessage = toString(Result.takeError()); ASSERT_EQ( - "malformed file\nTest.tbd:5:9: error: unknown key 'foobar'\nfoobar: " - "\"Unsupported key\"\n ^~~~~~~~~~~~~~~~~\n", + "malformed file\nTest.tbd:5:1: error: unknown key 'foobar'\nfoobar: " + "\"Unsupported key\"\n^~~~~~\n", ErrorMessage); } diff --git a/llvm/unittests/TextAPI/TextStubV3Tests.cpp b/llvm/unittests/TextAPI/TextStubV3Tests.cpp index a6a88c4..2881c95 100644 --- a/llvm/unittests/TextAPI/TextStubV3Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV3Tests.cpp @@ -831,8 +831,8 @@ TEST(TBDv3, MalformedFile2) { EXPECT_FALSE(!!Result); std::string ErrorMessage = toString(Result.takeError()); ASSERT_EQ( - "malformed file\nTest.tbd:5:9: error: unknown key 'foobar'\nfoobar: " - "\"Unsupported key\"\n ^~~~~~~~~~~~~~~~~\n", + "malformed file\nTest.tbd:5:1: error: unknown key 'foobar'\nfoobar: " + "\"Unsupported key\"\n^~~~~~\n", ErrorMessage); } diff --git a/llvm/unittests/TextAPI/TextStubV4Tests.cpp b/llvm/unittests/TextAPI/TextStubV4Tests.cpp index 43b53e1..0ab9c52 100644 --- a/llvm/unittests/TextAPI/TextStubV4Tests.cpp +++ b/llvm/unittests/TextAPI/TextStubV4Tests.cpp @@ -924,8 +924,8 @@ TEST(TBDv4, MalformedFile2) { EXPECT_FALSE(!!Result); std::string ErrorMessage = toString(Result.takeError()); ASSERT_EQ( - "malformed file\nTest.tbd:5:9: error: unknown key 'foobar'\nfoobar: " - "\"unsupported key\"\n ^~~~~~~~~~~~~~~~~\n", + "malformed file\nTest.tbd:5:1: error: unknown key 'foobar'\nfoobar: " + "\"unsupported key\"\n^~~~~~\n", ErrorMessage); } -- cgit v1.1