[cfe-commits] r98478 - /cfe/trunk/lib/Frontend/CacheTokens.cpp
Kovarththanan Rajaratnam
kovarththanan.rajaratnam at gmail.com
Sat Mar 13 23:38:15 PST 2010
Author: krj
Date: Sun Mar 14 01:38:15 2010
New Revision: 98478
URL: http://llvm.org/viewvc/llvm-project?rev=98478&view=rev
Log:
Pass file string by reference
Modified:
cfe/trunk/lib/Frontend/CacheTokens.cpp
Modified: cfe/trunk/lib/Frontend/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CacheTokens.cpp?rev=98478&r1=98477&r2=98478&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CacheTokens.cpp (original)
+++ cfe/trunk/lib/Frontend/CacheTokens.cpp Sun Mar 14 01:38:15 2010
@@ -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());
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list