Fixed to properly escape quotes in strings.

llvm-svn: 3991
This commit is contained in:
Nick Hildenbrandt 2002-09-30 21:11:55 +00:00
parent fd400215d5
commit 386834b2f1
1 changed files with 6 additions and 1 deletions

View File

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