aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-04 20:33:40 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-04 20:33:40 +0000
commit1c1508b37bc2a9419b2e22beef9e788eb74203f4 (patch)
tree808db0873c6bf272778a7b75982f9b6816e34252
parent8cc9c9d2235b7ac45c480de49eb5a1d10dba4154 (diff)
[PCH] In HeaderFileInfoTrait::EqualKey(), use FileManager::getFile() to compare two filenames, instead of llvm::sys::fs::equivalent().
llvm::sys::fs::equivalent() does 2 stat calls every time it's called. Use FileManager::getFile() to take advantage of the stat caching that FileManager is providing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176450 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Serialization/ASTReader.h1
-rw-r--r--lib/Serialization/ASTReader.cpp9
2 files changed, 5 insertions, 5 deletions
diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h
index 297b577eee..2744865819 100644
--- a/include/clang/Serialization/ASTReader.h
+++ b/include/clang/Serialization/ASTReader.h
@@ -1135,6 +1135,7 @@ public:
~ASTReader();
SourceManager &getSourceManager() const { return SourceMgr; }
+ FileManager &getFileManager() const { return FileMgr; }
/// \brief Flags that indicate what kind of AST loading failures the client
/// of the AST reader can directly handle.
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index e6ef9f6441..4a4f2aaf91 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -1309,11 +1309,10 @@ bool HeaderFileInfoTrait::EqualKey(internal_key_type a, internal_key_type b) {
return false;
// Determine whether the actual files are equivalent.
- bool Result = false;
- if (llvm::sys::fs::equivalent(a, b, Result))
- return false;
-
- return Result;
+ FileManager &FileMgr = Reader.getFileManager();
+ const FileEntry *FEA = FileMgr.getFile(a);
+ const FileEntry *FEB = FileMgr.getFile(b);
+ return (FEA && FEA == FEB);
}
std::pair<unsigned, unsigned>