diff options
author | Nathan James <n.james93@hotmail.co.uk> | 2020-12-11 16:34:06 +0000 |
---|---|---|
committer | Nathan James <n.james93@hotmail.co.uk> | 2020-12-11 16:34:06 +0000 |
commit | d380c38e3470c5b02a3002a7ea8d836f44086b31 (patch) | |
tree | e0a0c67793eefe9e6bc2a07b0ec042ad55706b27 /llvm/unittests/TextAPI | |
parent | cf638f84a4ba1b0a1ba229b12c89bd6c96912fb5 (diff) | |
download | llvm-d380c38e3470c5b02a3002a7ea8d836f44086b31.zip llvm-d380c38e3470c5b02a3002a7ea8d836f44086b31.tar.gz llvm-d380c38e3470c5b02a3002a7ea8d836f44086b31.tar.bz2 |
[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
Diffstat (limited to 'llvm/unittests/TextAPI')
-rw-r--r-- | llvm/unittests/TextAPI/TextStubV1Tests.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/TextAPI/TextStubV2Tests.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/TextAPI/TextStubV3Tests.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/TextAPI/TextStubV4Tests.cpp | 4 |
4 files changed, 8 insertions, 8 deletions
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); } |