diff options
author | Chris Lattner <sabre@nondot.org> | 2008-08-19 04:23:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-08-19 04:23:15 +0000 |
commit | e9d89d886a240f9ba7c49bfdeac4e468ac92f674 (patch) | |
tree | e233ed5d94806c5d1bfaccb3654963ab6585a1c1 | |
parent | 6ec6ed3df1ffc5ae1e4a86d038d2fe31f9ed1474 (diff) |
Use raw_ostream to output an unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54973 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/PrintPreprocessedOutput.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index b9030087bc..3fe3e40a54 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -73,21 +73,6 @@ public: }; } // end anonymous namespace -/// UToStr - Do itoa on the specified number, in-place in the specified buffer. -/// endptr points to the end of the buffer. -static char *UToStr(unsigned N, char *EndPtr) { - // Null terminate the buffer. - *--EndPtr = '\0'; - if (N == 0) // Zero is a special case. - *--EndPtr = '0'; - while (N) { - *--EndPtr = '0' + char(N % 10); - N /= 10; - } - return EndPtr; -} - - /// MoveToLine - Move the output to the source line specified by the location /// object. We can do this by emitting some number of \n's, or be emitting a /// #line directive. This returns false if already at the specified line, true @@ -129,12 +114,7 @@ bool PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) { CurLine = LineNo; - OS << '#' << ' '; - char NumberBuffer[20]; - const char *NumStr = UToStr(LineNo, NumberBuffer+20); - OS.write(NumStr, (NumberBuffer+20)-NumStr-1); - OS << ' '; - OS << '"'; + OS << '#' << ' ' << LineNo << ' ' << '"'; OS.write(&CurFilename[0], CurFilename.size()); OS << '"'; @@ -182,12 +162,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, EmittedTokensOnThisLine = false; } - OS << '#' << ' '; - - char NumberBuffer[20]; - const char *NumStr = UToStr(CurLine, NumberBuffer+20); - OS.write(NumStr, (NumberBuffer+20)-NumStr-1); - OS << ' ' << '"'; + OS << '#' << ' ' << CurLine << ' ' << '"'; OS.write(&CurFilename[0], CurFilename.size()); OS << '"'; |