Revert "YAMLIO: Encode ambiguous hex strings explicitly"
authorFilipe Cabecinhas <me@filcab.net>
Wed, 9 Apr 2014 14:35:17 +0000 (14:35 +0000)
committerFilipe Cabecinhas <me@filcab.net>
Wed, 9 Apr 2014 14:35:17 +0000 (14:35 +0000)
This reverts commit r205839.

It broke several tests in lld.

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

lib/Support/YAMLTraits.cpp
test/Object/X86/objdump-cfg-invalid-opcode.yaml
unittests/Support/YAMLIOTest.cpp

index 3b4bb7dbc97eafc30429e061dc4ad011bb43bf16..38f3ec7c7f9cc77c1b3b4f73d6fe988fb7e7a729 100644 (file)
@@ -561,11 +561,8 @@ void Output::scalarString(StringRef &S) {
     this->outputUpToEndOfLine("''");
     return;
   }
-  bool isOctalString = S.front() == '0' &&
-                       S.find_first_not_of('0') != StringRef::npos &&
-                       !S.startswith_lower("0x");
   if (S.find_first_not_of(ScalarSafeChars) == StringRef::npos &&
-      !isspace(S.front()) && !isspace(S.back()) && !isOctalString) {
+      !isspace(S.front()) && !isspace(S.back())) {
     // If the string consists only of safe characters, print it out without
     // quotes.
     this->outputUpToEndOfLine(S);
index d0a29be8697d0206873b6f64d0f040daba82078c..56ab1d274eef71c6113a855d5662b88ace61a30f 100644 (file)
@@ -38,7 +38,7 @@ Sections:
 #CFG:     Type:            Data
 
 ##    4:   06                      (bad)
-#CFG:     Content:         '06'
+#CFG:     Content:         06
 
 #CFG:   - StartAddress:    0x0000000000000005
 #CFG:     Size:            1
index 0f1951f4fcb3af3103473aa25b14e80e0a827156..52a8f6b88c243333e2ed26677ebcf6dc8ea02fe9 100644 (file)
@@ -302,13 +302,11 @@ struct StringTypes {
   llvm::StringRef str3;
   llvm::StringRef str4;
   llvm::StringRef str5;
-  llvm::StringRef str6;
   std::string stdstr1;
   std::string stdstr2;
   std::string stdstr3;
   std::string stdstr4;
   std::string stdstr5;
-  std::string stdstr6;
 };
 
 namespace llvm {
@@ -321,13 +319,11 @@ namespace yaml {
       io.mapRequired("str3",      st.str3);
       io.mapRequired("str4",      st.str4);
       io.mapRequired("str5",      st.str5);
-      io.mapRequired("str6",      st.str6);
       io.mapRequired("stdstr1",   st.stdstr1);
       io.mapRequired("stdstr2",   st.stdstr2);
       io.mapRequired("stdstr3",   st.stdstr3);
       io.mapRequired("stdstr4",   st.stdstr4);
       io.mapRequired("stdstr5",   st.stdstr5);
-      io.mapRequired("stdstr6",   st.stdstr6);
     }
   };
 }
@@ -342,13 +338,11 @@ TEST(YAMLIO, TestReadWriteStringTypes) {
     map.str3 = "`ccc";
     map.str4 = "@ddd";
     map.str5 = "";
-    map.str6 = "0000000004000000";
     map.stdstr1 = "'eee";
     map.stdstr2 = "\"fff";
     map.stdstr3 = "`ggg";
     map.stdstr4 = "@hhh";
     map.stdstr5 = "";
-    map.stdstr6 = "0000000004000000";
 
     llvm::raw_string_ostream ostr(intermediate);
     Output yout(ostr);
@@ -361,13 +355,11 @@ TEST(YAMLIO, TestReadWriteStringTypes) {
   EXPECT_NE(llvm::StringRef::npos, flowOut.find("'`ccc'"));
   EXPECT_NE(llvm::StringRef::npos, flowOut.find("'@ddd'"));
   EXPECT_NE(llvm::StringRef::npos, flowOut.find("''\n"));
-  EXPECT_NE(llvm::StringRef::npos, flowOut.find("'0000000004000000'\n"));
   EXPECT_NE(std::string::npos, flowOut.find("'''eee"));
   EXPECT_NE(std::string::npos, flowOut.find("'\"fff'"));
   EXPECT_NE(std::string::npos, flowOut.find("'`ggg'"));
   EXPECT_NE(std::string::npos, flowOut.find("'@hhh'"));
   EXPECT_NE(std::string::npos, flowOut.find("''\n"));
-  EXPECT_NE(std::string::npos, flowOut.find("'0000000004000000'\n"));
 
   {
     Input yin(intermediate);
@@ -380,13 +372,11 @@ TEST(YAMLIO, TestReadWriteStringTypes) {
     EXPECT_TRUE(map.str3.equals("`ccc"));
     EXPECT_TRUE(map.str4.equals("@ddd"));
     EXPECT_TRUE(map.str5.equals(""));
-    EXPECT_TRUE(map.str6.equals("0000000004000000"));
     EXPECT_TRUE(map.stdstr1 == "'eee");
     EXPECT_TRUE(map.stdstr2 == "\"fff");
     EXPECT_TRUE(map.stdstr3 == "`ggg");
     EXPECT_TRUE(map.stdstr4 == "@hhh");
     EXPECT_TRUE(map.stdstr5 == "");
-    EXPECT_TRUE(map.stdstr6 == "0000000004000000");
   }
 }