diff options
Diffstat (limited to 'llvm/lib/Support/YAMLTraits.cpp')
-rw-r--r-- | llvm/lib/Support/YAMLTraits.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 38f3ec7..3b4bb7d 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -561,8 +561,11 @@ 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())) { + !isspace(S.front()) && !isspace(S.back()) && !isOctalString) { // If the string consists only of safe characters, print it out without // quotes. this->outputUpToEndOfLine(S); |