]> granicus.if.org Git - clang/commitdiff
avoid a small bit of string traffic by not storing the ""'s around a string in CurFil...
authorChris Lattner <sabre@nondot.org>
Sun, 22 Jul 2007 06:38:50 +0000 (06:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Jul 2007 06:38:50 +0000 (06:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40385 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/PrintPreprocessedOutput.cpp

index 46278f1a07e1e242649942df443f408426b221f4..38b6cfece210b04e2e1f9c1e2c690c6772ef3c85 100644 (file)
@@ -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: