diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-07-22 06:38:50 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-07-22 06:38:50 +0000 |
| commit | 9b7962495fcb8a983797ebe9fdcc2d4a752905fe (patch) | |
| tree | e032978b7e82299d0d05256892ca09ec2dcddf90 | |
| parent | b9b8597c2304ecbb08ed1ed5dc899a604cef5144 (diff) | |
| download | bcm5719-llvm-9b7962495fcb8a983797ebe9fdcc2d4a752905fe.tar.gz bcm5719-llvm-9b7962495fcb8a983797ebe9fdcc2d4a752905fe.zip | |
avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename
llvm-svn: 40385
| -rw-r--r-- | clang/Driver/PrintPreprocessedOutput.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/Driver/PrintPreprocessedOutput.cpp b/clang/Driver/PrintPreprocessedOutput.cpp index 46278f1a07e..38b6cfece21 100644 --- a/clang/Driver/PrintPreprocessedOutput.cpp +++ b/clang/Driver/PrintPreprocessedOutput.cpp @@ -116,7 +116,7 @@ class PrintPPOutputPPCallbacks : public PPCallbacks { public: PrintPPOutputPPCallbacks(Preprocessor &pp) : PP(pp) { CurLine = 0; - CurFilename = "\"<uninit>\""; + CurFilename = "<uninit>"; EmittedTokensOnThisLine = false; FileType = DirectoryLookup::NormalHeaderDir; } @@ -168,7 +168,9 @@ void PrintPPOutputPPCallbacks::MoveToLine(SourceLocation Loc) { std::string Num = llvm::utostr_32(LineNo); OutputString(&Num[0], Num.size()); OutputChar(' '); + OutputChar('"'); OutputString(&CurFilename[0], CurFilename.size()); + OutputChar('"'); if (FileType == DirectoryLookup::SystemHeaderDir) OutputString(" 3", 2); @@ -202,7 +204,7 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, Loc = SourceMgr.getLogicalLoc(Loc); CurLine = SourceMgr.getLineNumber(Loc); - CurFilename = '"' + Lexer::Stringify(SourceMgr.getSourceName(Loc)) + '"'; + CurFilename = Lexer::Stringify(SourceMgr.getSourceName(Loc)); FileType = FileType; if (EmittedTokensOnThisLine) { @@ -217,7 +219,9 @@ void PrintPPOutputPPCallbacks::FileChanged(SourceLocation Loc, std::string Num = llvm::utostr_32(CurLine); OutputString(&Num[0], Num.size()); OutputChar(' '); + OutputChar('"'); OutputString(&CurFilename[0], CurFilename.size()); + OutputChar('"'); switch (Reason) { case PPCallbacks::EnterFile: |

