summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderInternals.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-06 18:12:47 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-06 18:12:47 +0000
commit5c2a345e4847c3913cccdecfe6429e09d8d2b1a8 (patch)
treea1fde41ae5f89250c116e186d88503d32054d5a5 /clang/lib/Serialization/ASTReaderInternals.h
parent61a3896d9fe122dafef192a00a7672315761424f (diff)
downloadbcm5719-llvm-5c2a345e4847c3913cccdecfe6429e09d8d2b1a8.tar.gz
bcm5719-llvm-5c2a345e4847c3913cccdecfe6429e09d8d2b1a8.zip
[PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.
Previously the hash would be the filename portion of the path, which could be different for a filename with different case or a symbolic link with a different name completely. This did not actually create any issue so far because by validating all headers in the PCH we created uniqued FileEntries based on inodes, so an #include of a symbolic link (refering to a file from the PCH) would end up with a FileEntry with filename same as the one recorded in the PCH. llvm-svn: 176566
Diffstat (limited to 'clang/lib/Serialization/ASTReaderInternals.h')
-rw-r--r--clang/lib/Serialization/ASTReaderInternals.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/clang/lib/Serialization/ASTReaderInternals.h b/clang/lib/Serialization/ASTReaderInternals.h
index ceae0f82b14..327da4403a3 100644
--- a/clang/lib/Serialization/ASTReaderInternals.h
+++ b/clang/lib/Serialization/ASTReaderInternals.h
@@ -25,6 +25,7 @@ namespace clang {
class ASTReader;
class HeaderSearch;
struct HeaderFileInfo;
+class FileEntry;
namespace serialization {
@@ -198,8 +199,14 @@ class HeaderFileInfoTrait {
const char *FrameworkStrings;
public:
- typedef const char *external_key_type;
- typedef const char *internal_key_type;
+ typedef const FileEntry *external_key_type;
+
+ struct internal_key_type {
+ off_t Size;
+ time_t ModTime;
+ const char *Filename;
+ };
+ typedef const internal_key_type &internal_key_ref;
typedef HeaderFileInfo data_type;
@@ -207,19 +214,16 @@ public:
const char *FrameworkStrings)
: Reader(Reader), M(M), HS(HS), FrameworkStrings(FrameworkStrings) { }
- static unsigned ComputeHash(const char *path);
- static internal_key_type GetInternalKey(const char *path);
- bool EqualKey(internal_key_type a, internal_key_type b);
+ static unsigned ComputeHash(internal_key_ref ikey);
+ static internal_key_type GetInternalKey(const FileEntry *FE);
+ bool EqualKey(internal_key_ref a, internal_key_ref b);
static std::pair<unsigned, unsigned>
ReadKeyDataLength(const unsigned char*& d);
- static internal_key_type ReadKey(const unsigned char *d, unsigned) {
- return (const char *)d;
- }
+ static internal_key_type ReadKey(const unsigned char *d, unsigned);
- data_type ReadData(const internal_key_type, const unsigned char *d,
- unsigned DataLen);
+ data_type ReadData(internal_key_ref,const unsigned char *d, unsigned DataLen);
};
/// \brief The on-disk hash table used for known header files.
OpenPOWER on IntegriCloud