llvm.org GIT mirror llvm / c657a09
Revert "YAMLIO: Encode ambiguous hex strings explicitly" 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 Filipe Cabecinhas 6 years ago
3 changed file(s) with 2 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
560560 this->outputUpToEndOfLine("''");
561561 return;
562562 }
563 bool isOctalString = S.front() == '0' &&
564 S.find_first_not_of('0') != StringRef::npos &&
565 !S.startswith_lower("0x");
566563 if (S.find_first_not_of(ScalarSafeChars) == StringRef::npos &&
567 !isspace(S.front()) && !isspace(S.back()) && !isOctalString) {
564 !isspace(S.front()) && !isspace(S.back())) {
568565 // If the string consists only of safe characters, print it out without
569566 // quotes.
570567 this->outputUpToEndOfLine(S);
3737 #CFG: Type: Data
3838
3939 ## 4: 06 (bad)
40 #CFG: Content: '06'
40 #CFG: Content: 06
4141
4242 #CFG: - StartAddress: 0x0000000000000005
4343 #CFG: Size: 1
301301 llvm::StringRef str3;
302302 llvm::StringRef str4;
303303 llvm::StringRef str5;
304 llvm::StringRef str6;
305304 std::string stdstr1;
306305 std::string stdstr2;
307306 std::string stdstr3;
308307 std::string stdstr4;
309308 std::string stdstr5;
310 std::string stdstr6;
311309 };
312310
313311 namespace llvm {
320318 io.mapRequired("str3", st.str3);
321319 io.mapRequired("str4", st.str4);
322320 io.mapRequired("str5", st.str5);
323 io.mapRequired("str6", st.str6);
324321 io.mapRequired("stdstr1", st.stdstr1);
325322 io.mapRequired("stdstr2", st.stdstr2);
326323 io.mapRequired("stdstr3", st.stdstr3);
327324 io.mapRequired("stdstr4", st.stdstr4);
328325 io.mapRequired("stdstr5", st.stdstr5);
329 io.mapRequired("stdstr6", st.stdstr6);
330326 }
331327 };
332328 }
341337 map.str3 = "`ccc";
342338 map.str4 = "@ddd";
343339 map.str5 = "";
344 map.str6 = "0000000004000000";
345340 map.stdstr1 = "'eee";
346341 map.stdstr2 = "\"fff";
347342 map.stdstr3 = "`ggg";
348343 map.stdstr4 = "@hhh";
349344 map.stdstr5 = "";
350 map.stdstr6 = "0000000004000000";
351345
352346 llvm::raw_string_ostream ostr(intermediate);
353347 Output yout(ostr);
360354 EXPECT_NE(llvm::StringRef::npos, flowOut.find("'`ccc'"));
361355 EXPECT_NE(llvm::StringRef::npos, flowOut.find("'@ddd'"));
362356 EXPECT_NE(llvm::StringRef::npos, flowOut.find("''\n"));
363 EXPECT_NE(llvm::StringRef::npos, flowOut.find("'0000000004000000'\n"));
364357 EXPECT_NE(std::string::npos, flowOut.find("'''eee"));
365358 EXPECT_NE(std::string::npos, flowOut.find("'\"fff'"));
366359 EXPECT_NE(std::string::npos, flowOut.find("'`ggg'"));
367360 EXPECT_NE(std::string::npos, flowOut.find("'@hhh'"));
368361 EXPECT_NE(std::string::npos, flowOut.find("''\n"));
369 EXPECT_NE(std::string::npos, flowOut.find("'0000000004000000'\n"));
370362
371363 {
372364 Input yin(intermediate);
379371 EXPECT_TRUE(map.str3.equals("`ccc"));
380372 EXPECT_TRUE(map.str4.equals("@ddd"));
381373 EXPECT_TRUE(map.str5.equals(""));
382 EXPECT_TRUE(map.str6.equals("0000000004000000"));
383374 EXPECT_TRUE(map.stdstr1 == "'eee");
384375 EXPECT_TRUE(map.stdstr2 == "\"fff");
385376 EXPECT_TRUE(map.stdstr3 == "`ggg");
386377 EXPECT_TRUE(map.stdstr4 == "@hhh");
387378 EXPECT_TRUE(map.stdstr5 == "");
388 EXPECT_TRUE(map.stdstr6 == "0000000004000000");
389379 }
390380 }
391381