mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
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:
@ -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');
|
||||||
|
@ -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');
|
||||||
|
Reference in New Issue
Block a user