[llvm] r239976 - Revert r239972 (YAML: Assign a value returned by the default constructor to the value in an optional mapping).

Alex Lorenz arphaman at gmail.com
Wed Jun 17 16:48:07 PDT 2015


Author: arphaman
Date: Wed Jun 17 18:48:06 2015
New Revision: 239976

URL: http://llvm.org/viewvc/llvm-project?rev=239976&view=rev
Log:
Revert r239972 (YAML: Assign a value returned by the default constructor to the value in an optional mapping).

This change breaks clang-format tests.

Modified:
    llvm/trunk/include/llvm/Support/YAMLTraits.h
    llvm/trunk/unittests/Support/YAMLIOTest.cpp

Modified: llvm/trunk/include/llvm/Support/YAMLTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/YAMLTraits.h?rev=239976&r1=239975&r2=239976&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/YAMLTraits.h (original)
+++ llvm/trunk/include/llvm/Support/YAMLTraits.h Wed Jun 17 18:48:06 2015
@@ -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();
     }
   }
 

Modified: llvm/trunk/unittests/Support/YAMLIOTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/YAMLIOTest.cpp?rev=239976&r1=239975&r2=239976&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/YAMLIOTest.cpp (original)
+++ llvm/trunk/unittests/Support/YAMLIOTest.cpp Wed Jun 17 18:48:06 2015
@@ -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);





More information about the llvm-commits mailing list