[cfe-commits] r40385 - /cfe/trunk/Driver/PrintPreprocessedOutput.cpp

Chris Lattner sabre at nondot.org
Sat Jul 21 23:38:50 PDT 2007


Author: lattner
Date: Sun Jul 22 01:38:50 2007
New Revision: 40385

URL: http://llvm.org/viewvc/llvm-project?rev=40385&view=rev
Log:
avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename

Modified:
    cfe/trunk/Driver/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/Driver/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/PrintPreprocessedOutput.cpp?rev=40385&r1=40384&r2=40385&view=diff

==============================================================================
--- cfe/trunk/Driver/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/Driver/PrintPreprocessedOutput.cpp Sun Jul 22 01:38:50 2007
@@ -116,7 +116,7 @@
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp) : PP(pp) {
     CurLine = 0;
-    CurFilename = "\"<uninit>\"";
+    CurFilename = "<uninit>";
     EmittedTokensOnThisLine = false;
     FileType = DirectoryLookup::NormalHeaderDir;
   }
@@ -168,7 +168,9 @@
     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 @@
   
   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 @@
   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:





More information about the cfe-commits mailing list