summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/YAMLTraits.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-04-09 17:04:27 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-04-09 17:04:27 +0000
commit97d8ee382467a2c14a97ca6b31bf703b159af133 (patch)
treef749b00b30c4c259c9da772b90f600fa233754ce /llvm/lib/Support/YAMLTraits.cpp
parentfec969a0af8e50d4cf420271ece94846d59507f6 (diff)
downloadbcm5719-llvm-97d8ee382467a2c14a97ca6b31bf703b159af133.tar.gz
bcm5719-llvm-97d8ee382467a2c14a97ca6b31bf703b159af133.zip
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
Diffstat (limited to 'llvm/lib/Support/YAMLTraits.cpp')
-rw-r--r--llvm/lib/Support/YAMLTraits.cpp3
1 files changed, 2 insertions, 1 deletions
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);
OpenPOWER on IntegriCloud