Pass file string by reference

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98478 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp
index b845178..5cc56ae 100644
--- a/lib/Frontend/CacheTokens.cpp
+++ b/lib/Frontend/CacheTokens.cpp
@@ -214,7 +214,7 @@
     : Out(out), PP(pp), idcount(0), CurStrOffset(0) {}
 
   PTHMap &getPM() { return PM; }
-  void GeneratePTH(const std::string *MainFile = 0);
+  void GeneratePTH(const std::string &MainFile);
 };
 } // end anonymous namespace
 
@@ -435,7 +435,7 @@
   return SpellingsOff;
 }
 
-void PTHWriter::GeneratePTH(const std::string *MainFile) {
+void PTHWriter::GeneratePTH(const std::string &MainFile) {
   // Generate the prologue.
   Out << "cfe-pth";
   Emit32(PTHManager::Version);
@@ -446,7 +446,7 @@
     Emit32(0);
 
   // Write the name of the MainFile.
-  if (MainFile && !MainFile->empty()) {
+  if (!MainFile->empty()) {
     Emit16(MainFile->length());
     EmitBuf(MainFile->data(), MainFile->length());
   } else {
@@ -532,10 +532,8 @@
   const SourceManager &SrcMgr = PP.getSourceManager();
   const FileEntry *MainFile = SrcMgr.getFileEntryForID(SrcMgr.getMainFileID());
   llvm::sys::Path MainFilePath(MainFile->getName());
-  std::string MainFileName;
 
   MainFilePath.makeAbsolute();
-  MainFileName = MainFilePath.str();
 
   // Create the PTHWriter.
   PTHWriter PW(*OS, PP);
@@ -552,7 +550,7 @@
 
   // Generate the PTH file.
   PP.getFileManager().removeStatCache(StatCache);
-  PW.GeneratePTH(&MainFileName);
+  PW.GeneratePTH(MainFilePath.str());
 }
 
 //===----------------------------------------------------------------------===//