diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-23 19:28:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-23 19:28:12 +0000 |
commit | 74e976ba4b0d407bb798ea26476f618e256fc8c7 (patch) | |
tree | 57aba6b267132c96e7e313d3400c93e97db6ce26 /lib/Serialization/ASTWriter.cpp | |
parent | 10e286aa8d39fb51a21412850265d9dae74613ee (diff) |
PCH files only cache successful stats. Remove the code that reads/writes
the result code of the stat to/from the PCH file since it is always 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index f3852af00f..468729a371 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -904,8 +904,8 @@ public: typedef const char * key_type; typedef key_type key_type_ref; - typedef std::pair<int, struct stat> data_type; - typedef const data_type& data_type_ref; + typedef struct stat data_type; + typedef const data_type &data_type_ref; static unsigned ComputeHash(const char *path) { return llvm::HashString(path); @@ -916,9 +916,7 @@ public: data_type_ref Data) { unsigned StrLen = strlen(path); clang::io::Emit16(Out, StrLen); - unsigned DataLen = 1; // result value - if (Data.first == 0) - DataLen += 4 + 4 + 2 + 8 + 8; + unsigned DataLen = 4 + 4 + 2 + 8 + 8; clang::io::Emit8(Out, DataLen); return std::make_pair(StrLen + 1, DataLen); } @@ -927,21 +925,16 @@ public: Out.write(path, KeyLen); } - void EmitData(llvm::raw_ostream& Out, key_type_ref, + void EmitData(llvm::raw_ostream &Out, key_type_ref, data_type_ref Data, unsigned DataLen) { using namespace clang::io; uint64_t Start = Out.tell(); (void)Start; - // Result of stat() - Emit8(Out, Data.first? 1 : 0); - - if (Data.first == 0) { - Emit32(Out, (uint32_t) Data.second.st_ino); - Emit32(Out, (uint32_t) Data.second.st_dev); - Emit16(Out, (uint16_t) Data.second.st_mode); - Emit64(Out, (uint64_t) Data.second.st_mtime); - Emit64(Out, (uint64_t) Data.second.st_size); - } + Emit32(Out, (uint32_t) Data.st_ino); + Emit32(Out, (uint32_t) Data.st_dev); + Emit16(Out, (uint16_t) Data.st_mode); + Emit64(Out, (uint64_t) Data.st_mtime); + Emit64(Out, (uint64_t) Data.st_size); assert(Out.tell() - Start == DataLen && "Wrong data length"); } |