diff options
author | Nick Hildenbrandt <hldnbrnd@uiuc.edu> | 2002-09-30 21:11:55 +0000 |
---|---|---|
committer | Nick Hildenbrandt <hldnbrnd@uiuc.edu> | 2002-09-30 21:11:55 +0000 |
commit | c3dd2af4283d551437d40649b4a383cd14727ef1 (patch) | |
tree | 31083b664646e86903517b993bf683c5a350f969 /lib/Target/CBackend/CBackend.cpp | |
parent | 999b63b4535c0ffe0328381fb5da4579e7f2fcc0 (diff) |
Fixed to properly escape quotes in strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index e54d457512..8b7aba9398 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -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'); |