From: Chris Lattner Date: Sun, 22 Jul 2007 06:38:50 +0000 (+0000) Subject: avoid a small bit of string traffic by not storing the ""'s around a string in CurFil... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cbc4b593c09022d80b12664b7621c1f939df412;p=clang avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40385 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/PrintPreprocessedOutput.cpp b/Driver/PrintPreprocessedOutput.cpp index 46278f1a07..38b6cfece2 100644 --- a/Driver/PrintPreprocessedOutput.cpp +++ b/Driver/PrintPreprocessedOutput.cpp @@ -116,7 +116,7 @@ class PrintPPOutputPPCallbacks : public PPCallbacks { public: PrintPPOutputPPCallbacks(Preprocessor &pp) : PP(pp) { CurLine = 0; - CurFilename = "\"\""; + CurFilename = ""; 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: