[YAML] Use correct source location for unknown key errors.
authorNathan James <n.james93@hotmail.co.uk>
Fri, 11 Dec 2020 16:34:06 +0000 (16:34 +0000)
committerNathan James <n.james93@hotmail.co.uk>
Fri, 11 Dec 2020 16:34:06 +0000 (16:34 +0000)
commitd380c38e3470c5b02a3002a7ea8d836f44086b31
treee0a0c67793eefe9e6bc2a07b0ec042ad55706b27
parentcf638f84a4ba1b0a1ba229b12c89bd6c96912fb5
[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
12 files changed:
llvm/include/llvm/Support/YAMLParser.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/Support/YAMLParser.cpp
llvm/lib/Support/YAMLTraits.cpp
llvm/test/CodeGen/MIR/X86/spill-slot-fixed-stack-object-aliased.mir
llvm/test/CodeGen/MIR/X86/spill-slot-fixed-stack-object-immutable.mir
llvm/test/CodeGen/MIR/X86/variable-sized-stack-object-size-error.mir
llvm/test/Object/nm-tapi-invalids.test
llvm/unittests/TextAPI/TextStubV1Tests.cpp
llvm/unittests/TextAPI/TextStubV2Tests.cpp
llvm/unittests/TextAPI/TextStubV3Tests.cpp
llvm/unittests/TextAPI/TextStubV4Tests.cpp