YamlIO custom scalar example fix

Mario Lang via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 04:04:23 PST 2016


The YAML IO "Custom scalar" sample code looks wrong.
It makes use of "T", while "T" is nowhere defined.

diff --git a/docs/YamlIO.rst b/docs/YamlIO.rst
index f0baeb4..7614679 100644
--- a/docs/YamlIO.rst
+++ b/docs/YamlIO.rst
@@ -456,10 +456,10 @@ looks like:
     template <>
     struct ScalarTraits<MyCustomType> {
-      static void output(const T &value, void*, llvm::raw_ostream &out) {
+      static void output(const MyCustomType &value, void*, llvm::raw_ostream &out) {
         out << value;  // do custom formatting here
-      static StringRef input(StringRef scalar, void*, T &value) {
+      static StringRef input(StringRef scalar, void*, MyCustomType &value) {
         // do custom parsing here.  Return the empty string on success,
         // or an error message on failure.
         return StringRef();


More information about the llvm-commits mailing list