summaryrefslogtreecommitdiff
path: root/lib/Support/YAMLTraits.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/YAMLTraits.cpp')
-rw-r--r--lib/Support/YAMLTraits.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp
index 38f3ec7c7f..005a810774 100644
--- a/lib/Support/YAMLTraits.cpp
+++ b/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);