diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -1629,7 +1629,7 @@ bool IsNone = false; if (!outputting()) if (auto *Node = dyn_cast(((Input *)this)->getCurrentNode())) - IsNone = Node->getRawValue() == ""; + IsNone = Node->getRawValue().rtrim(' ') == ""; if (IsNone) Val = DefaultValue; diff --git a/llvm/test/tools/yaml2obj/ELF/none-value.yaml b/llvm/test/tools/yaml2obj/ELF/none-value.yaml --- a/llvm/test/tools/yaml2obj/ELF/none-value.yaml +++ b/llvm/test/tools/yaml2obj/ELF/none-value.yaml @@ -21,6 +21,7 @@ Sections: - Name: .bar Type: SHT_PROGBITS + Flags: [[TEST=]] ## Comment Offset: [[TEST=]] Address: [[TEST=]] Content: [[TEST=]]