Fixed to properly escape quotes in strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3991 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Hildenbrandt 2002-09-30 21:11:55 +00:00
parent 999b63b453
commit c3dd2af428
2 changed files with 12 additions and 2 deletions

View File

@ -287,7 +287,10 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
(unsigned char)cast<ConstantUInt>(CPA->getOperand(i))->getValue();
if (isprint(C)) {
Out << C;
if (C == '"')
Out << "\\\"";
else
Out << C;
} else {
switch (C) {
case '\n': Out << "\\n"; break;
@ -295,6 +298,8 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
case '\r': Out << "\\r"; break;
case '\v': Out << "\\v"; break;
case '\a': Out << "\\a"; break;
case '\"': Out << "\\\""; break;
case '\'': Out << "\\\'"; break;
default:
Out << "\\x";
Out << ( C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A');

View File

@ -287,7 +287,10 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
(unsigned char)cast<ConstantUInt>(CPA->getOperand(i))->getValue();
if (isprint(C)) {
Out << C;
if (C == '"')
Out << "\\\"";
else
Out << C;
} else {
switch (C) {
case '\n': Out << "\\n"; break;
@ -295,6 +298,8 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
case '\r': Out << "\\r"; break;
case '\v': Out << "\\v"; break;
case '\a': Out << "\\a"; break;
case '\"': Out << "\\\""; break;
case '\'': Out << "\\\'"; break;
default:
Out << "\\x";
Out << ( C/16 < 10) ? ( C/16 +'0') : ( C/16 -10+'A');