Revert r239972 (YAML: Assign a value returned by the default constructor to the value...
authorAlex Lorenz <arphaman@gmail.com>
Wed, 17 Jun 2015 23:48:06 +0000 (23:48 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 17 Jun 2015 23:48:06 +0000 (23:48 +0000)
This change breaks clang-format tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239976 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/YAMLTraits.h
unittests/Support/YAMLIOTest.cpp

index e06830c37cbc6a7daf40429f0a3a4d9b0cedb59b..c04294a5e87a735b3bf79b3475d60f47d01afab3 100644 (file)
@@ -647,8 +647,6 @@ private:
     if ( this->preflightKey(Key, Required, false, UseDefault, SaveInfo) ) {
       yamlize(*this, Val, Required);
       this->postflightKey(SaveInfo);
-    } else if (UseDefault) {
-      Val = T();
     }
   }
 
index 0c791b7a0201a4e3a49feeb2537dc813fa277c42..e7affa1698dcc7989ca59bdf23549f9164fac76d 100644 (file)
@@ -68,21 +68,6 @@ namespace yaml {
 }
 }
 
-struct FooBarOptional {
-  int Foo;
-  int Bar;
-};
-
-namespace llvm {
-namespace yaml {
-template <> struct MappingTraits<FooBarOptional> {
-  static void mapping(IO &YamlIO, FooBarOptional &Obj) {
-    YamlIO.mapRequired("foo", Obj.Foo);
-    YamlIO.mapOptional("bar", Obj.Bar);
-  }
-};
-}
-}
 
 //
 // Test the reading of a yaml mapping
@@ -108,19 +93,6 @@ TEST(YAMLIO, TestMapRead) {
   }
 }
 
-TEST(YAMLIO, TestMapReadOptional) {
-  FooBarOptional Doc;
-  Doc.Bar = 42;
-  {
-    Input In("---\nfoo:  3\n...\n");
-    In >> Doc;
-
-    EXPECT_FALSE(In.error());
-    EXPECT_EQ(Doc.Foo, 3);
-    EXPECT_EQ(Doc.Bar, 0);
-  }
-}
-
 TEST(YAMLIO, TestMalformedMapRead) {
   FooBar doc;
   Input yin("{foo: 3; bar: 5}", nullptr, suppressErrorMessages);