[llvm-commits] [llvm] r68577 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Tue Apr 7 17:28:40 PDT 2009
Author: lattner
Date: Tue Apr 7 19:28:38 2009
New Revision: 68577
URL: http://llvm.org/viewvc/llvm-project?rev=68577&view=rev
Log:
change printStringChar to emit characters as unsigned char instead of char,
avoiding sign extension for the top octet. For "negative" chars, we'd print
stuff like:
.asciz "\702...
now we print:
.asciz "\302...
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=68577&r1=68576&r2=68577&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Apr 7 19:28:38 2009
@@ -699,7 +699,7 @@
/// printStringChar - Print a char, escaped if necessary.
///
-static void printStringChar(raw_ostream &O, char C) {
+static void printStringChar(raw_ostream &O, unsigned char C) {
if (C == '"') {
O << "\\\"";
} else if (C == '\\') {
@@ -733,10 +733,8 @@
else
O << TAI->getAsciiDirective();
O << '\"';
- for (unsigned i = 0, N = String.size(); i < N; ++i) {
- unsigned char C = String[i];
- printStringChar(O, C);
- }
+ for (unsigned i = 0, N = String.size(); i < N; ++i)
+ printStringChar(O, String[i]);
if (AscizDirective)
O << '\"';
else
@@ -747,10 +745,8 @@
/// EmitFile - Emit a .file directive.
void AsmPrinter::EmitFile(unsigned Number, const std::string &Name) const {
O << "\t.file\t" << Number << " \"";
- for (unsigned i = 0, N = Name.size(); i < N; ++i) {
- unsigned char C = Name[i];
- printStringChar(O, C);
- }
+ for (unsigned i = 0, N = Name.size(); i < N; ++i)
+ printStringChar(O, Name[i]);
O << '\"';
}
More information about the llvm-commits
mailing list