aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-03-14 07:38:15 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-03-14 07:38:15 +0000
commit74e485e74e82ad2eefc546fbd32cb0a0274b0d1e (patch)
treed4d8690817f7ef5f4658156f7a32be57a9bca7ab
parentaba54a95e9d5e4dc9056abec6bb70ea777c4a7bc (diff)
Pass file string by reference
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98478 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Frontend/CacheTokens.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp
index b845178064..5cc56aef70 100644
--- a/lib/Frontend/CacheTokens.cpp
+++ b/lib/Frontend/CacheTokens.cpp
@@ -214,7 +214,7 @@ public:
: 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 @@ Offset PTHWriter::EmitCachedSpellings() {
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 @@ void PTHWriter::GeneratePTH(const std::string *MainFile) {
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 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) {
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 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) {
// Generate the PTH file.
PP.getFileManager().removeStatCache(StatCache);
- PW.GeneratePTH(&MainFileName);
+ PW.GeneratePTH(MainFilePath.str());
}
//===----------------------------------------------------------------------===//