[YAMLTraits] Fix mapping <none> value that followed by comments.
authorXing GUO <higuoxing@gmail.com>
Tue, 4 Aug 2020 08:47:38 +0000 (16:47 +0800)
committerXing GUO <higuoxing@gmail.com>
Tue, 4 Aug 2020 10:36:05 +0000 (18:36 +0800)
commit79b44a4d470041acf202027054ba86e935d86aa1
tree394ad0b3227a60b2a7187dfa8779fd992669fb42
parent4be13b15d69d9d70506277eb1900eadccd75f608
[YAMLTraits] Fix mapping <none> value that followed by comments.

When mapping an optional value, if the value is <none> and followed
by comments, there will be a parsing error. This patch helps fix this
issue.

e.g.,

When mapping the following YAML,

```
Sections:
  - Name:  blah
    Type:  SHT_foo
    Flags: [[FLAGS=<none>]] ## some comments.
```

the raw value of `ScalarNode` is "<none> " rather than "<none>". We need
to remove the spaces.

Differential Revision: https://reviews.llvm.org/D85180
llvm/include/llvm/Support/YAMLTraits.h
llvm/test/tools/yaml2obj/ELF/none-value.yaml