diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-08 00:28:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-08 00:28:38 +0000 |
commit | 69b586e5473ca5cb8bae18438a1060904ffda509 (patch) | |
tree | 135a23a2e0c2a9b0d403972c9cf08ada4472019e /llvm/lib | |
parent | ad3e549a53d08e0386764bd2c322a89769baa456 (diff) | |
download | bcm5719-llvm-69b586e5473ca5cb8bae18438a1060904ffda509.tar.gz bcm5719-llvm-69b586e5473ca5cb8bae18438a1060904ffda509.zip |
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...
llvm-svn: 68577
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 48085d59a26..8fc1b8b0195 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -699,7 +699,7 @@ static inline char toOctal(int X) { /// 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 @@ void AsmPrinter::EmitString(const std::string &String) const { 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 @@ void AsmPrinter::EmitString(const std::string &String) const { /// 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 << '\"'; } |