From 97d8ee382467a2c14a97ca6b31bf703b159af133 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 9 Apr 2014 17:04:27 +0000 Subject: Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly"" Don't quote octal compatible strings if they are only two wide, they aren't ambiguous. This reverts commit r205857 which reverted r205857. llvm-svn: 205914 --- llvm/lib/Support/YAMLTraits.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Support/YAMLTraits.cpp') diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 38f3ec7c7f9..005a8107748 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -561,8 +561,9 @@ void Output::scalarString(StringRef &S) { this->outputUpToEndOfLine("''"); return; } + bool isOctalString = S.front() == '0' && S.size() > 2 && !S.startswith("0x"); if (S.find_first_not_of(ScalarSafeChars) == StringRef::npos && - !isspace(S.front()) && !isspace(S.back())) { + !isspace(S.front()) && !isspace(S.back()) && !isOctalString) { // If the string consists only of safe characters, print it out without // quotes. this->outputUpToEndOfLine(S); -- cgit v1.2.3