[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 01:23:42 PDT 2020


Higuoxing added inline comments.


================
Comment at: llvm/include/llvm/Support/YAMLTraits.h:1631-1632
     if (!outputting())
       if (auto *Node = dyn_cast<ScalarNode>(((Input *)this)->getCurrentNode()))
-        IsNone = Node->getRawValue() == "<none>";
+        IsNone = Node->getRawValue().trim() == "<none>";
 
----------------
Another approach would be using `getValue(SmallVectorImpl<char> &Storage)`.

```
   /// Gets the value of this node as a StringRef.
   ///
   /// \param Storage is used to store the content of the returned StringRef iff
   ///        it requires any modification from how it appeared in the source.
   ///        This happens with escaped characters and multi-line literals.
   StringRef getValue(SmallVectorImpl<char> &Storage) const;
```

```
Flags: [[FLAGS='<none>']] can also be correctly parsed.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85180/new/

https://reviews.llvm.org/D85180



More information about the llvm-commits mailing list