[PATCH] D85180: [YAMLTraits] Fix mapping <none> value that followed by comments.
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 02:11:06 PDT 2020
Higuoxing updated this revision to Diff 282836.
Higuoxing marked an inline comment as done.
Higuoxing added a comment.
Address comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85180/new/
https://reviews.llvm.org/D85180
Files:
llvm/include/llvm/Support/YAMLTraits.h
llvm/test/tools/yaml2obj/ELF/none-value.yaml
Index: llvm/test/tools/yaml2obj/ELF/none-value.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/none-value.yaml
+++ llvm/test/tools/yaml2obj/ELF/none-value.yaml
@@ -21,6 +21,7 @@
Sections:
- Name: .bar
Type: SHT_PROGBITS
+ Flags: [[TEST=<none>]] ## Comment
Offset: [[TEST=<none>]]
Address: [[TEST=<none>]]
Content: [[TEST=<none>]]
Index: llvm/include/llvm/Support/YAMLTraits.h
===================================================================
--- llvm/include/llvm/Support/YAMLTraits.h
+++ llvm/include/llvm/Support/YAMLTraits.h
@@ -1629,7 +1629,9 @@
bool IsNone = false;
if (!outputting())
if (auto *Node = dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
- IsNone = Node->getRawValue() == "<none>";
+ // We use rtrim to ignore possible white spaces that might exist when a
+ // comment is present on the same line.
+ IsNone = Node->getRawValue().rtrim(' ') == "<none>";
if (IsNone)
Val = DefaultValue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85180.282836.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200804/d0b42b86/attachment.bin>
More information about the llvm-commits
mailing list