[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Nicholas Hildenbrandt hldnbrnd at cs.uiuc.edu
Mon Sep 30 16:13:01 PDT 2002


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.54 -> 1.55

---
Log message:

Fixed to properly escape quotes in strings.


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.54 llvm/lib/CWriter/Writer.cpp:1.55
--- llvm/lib/CWriter/Writer.cpp:1.54	Wed Sep 25 15:29:26 2002
+++ llvm/lib/CWriter/Writer.cpp	Mon Sep 30 16:11:55 2002
@@ -287,7 +287,10 @@
         (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 @@
         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');





More information about the llvm-commits mailing list