diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-13 22:08:39 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-13 22:08:39 +0000 |
commit | 590ad93bf59f4e5f6adcba0d78efc3a58cac15ce (patch) | |
tree | 4604218cb857720e595b3872193d4166deb05c10 /lib/Serialization/ASTWriter.cpp | |
parent | bda536df1f5ccd71256eeeab4adbd2cf3769d89e (diff) |
[PCH] When chaining a PCH and serializing HeaderSearch, make sure the HeaderFileInfos
from the primary PCH is deserialized, otherwise we lose info that headers were
already #imported/#included.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 0a7fe4c492..667b3a58dd 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -1220,14 +1220,14 @@ namespace { // Trait used for the on-disk hash table of header search information. class HeaderFileInfoTrait { ASTWriter &Writer; - HeaderSearch &HS; + const HeaderSearch &HS; // Keep track of the framework names we've used during serialization. SmallVector<char, 128> FrameworkStringData; llvm::StringMap<unsigned> FrameworkNameOffset; public: - HeaderFileInfoTrait(ASTWriter &Writer, HeaderSearch &HS) + HeaderFileInfoTrait(ASTWriter &Writer, const HeaderSearch &HS) : Writer(Writer), HS(HS) { } typedef const char *key_type; @@ -1306,7 +1306,7 @@ namespace { /// \param HS The header search structure to save. /// /// \param Chain Whether we're creating a chained AST file. -void ASTWriter::WriteHeaderSearch(HeaderSearch &HS, StringRef isysroot) { +void ASTWriter::WriteHeaderSearch(const HeaderSearch &HS, StringRef isysroot) { SmallVector<const FileEntry *, 16> FilesByUID; HS.getFileMgr().GetUniqueIDMapping(FilesByUID); @@ -1322,7 +1322,9 @@ void ASTWriter::WriteHeaderSearch(HeaderSearch &HS, StringRef isysroot) { if (!File) continue; - const HeaderFileInfo &HFI = HS.header_file_begin()[UID]; + // Use HeaderSearch's getFileInfo to make sure we get the HeaderFileInfo + // from the external source if it was not provided already. + const HeaderFileInfo &HFI = HS.getFileInfo(File); if (HFI.External && Chain) continue; |