Author: dgregor Date: Thu Oct 18 16:31:35 2012 New Revision: 166229 URL: http://llvm.org/viewvc/llvm-project?rev=166229&view=rev Log: Move the "RelocatablePCH" bit from the ASTReader to the module file.
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/include/clang/Serialization/Module.h cfe/trunk/lib/Serialization/ASTReader.cpp Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=166229&r1=166228&r2=166229&view=diff ============================================================================== --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Oct 18 16:31:35 2012 @@ -652,9 +652,6 @@ /// \brief The directory that the PCH we are reading is stored in. std::string CurrentDir; - /// \brief Whether this precompiled header is a relocatable PCH file. - bool RelocatablePCH; - /// \brief The system include root to be used when loading the /// precompiled header. std::string isysroot; @@ -871,7 +868,7 @@ /// into account all the necessary relocations. const FileEntry *getFileEntry(StringRef filename); - void MaybeAddSystemRootToFilename(std::string &Filename); + void MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename); ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type, ModuleFile *ImportedBy, Modified: cfe/trunk/include/clang/Serialization/Module.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/Module.h?rev=166229&r1=166228&r2=166229&view=diff ============================================================================== --- cfe/trunk/include/clang/Serialization/Module.h (original) +++ cfe/trunk/include/clang/Serialization/Module.h Thu Oct 18 16:31:35 2012 @@ -92,6 +92,9 @@ /// allow resolving headers even after headers+PCH was moved to a new path. std::string OriginalDir; + /// \brief Whether this precompiled header is a relocatable PCH file. + bool RelocatablePCH; + /// \brief The file entry for the module file. const FileEntry *File; Modified: cfe/trunk/lib/Serialization/ASTReader.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=166229&r1=166228&r2=166229&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ASTReader.cpp (original) +++ cfe/trunk/lib/Serialization/ASTReader.cpp Thu Oct 18 16:31:35 2012 @@ -848,7 +848,7 @@ unsigned FilenameLen = Record[Idx++]; std::string Filename(&Record[Idx], &Record[Idx] + FilenameLen); Idx += FilenameLen; - MaybeAddSystemRootToFilename(Filename); + MaybeAddSystemRootToFilename(F, Filename); FileIDs[I] = LineTable.getLineTableFilenameID(Filename); } @@ -1125,7 +1125,7 @@ std::string OrigFilename(BlobStart, BlobStart + BlobLen); std::string Filename = OrigFilename; - MaybeAddSystemRootToFilename(Filename); + MaybeAddSystemRootToFilename(*F, Filename); const FileEntry *File = OverriddenBuffer? FileMgr.getVirtualFile(Filename, (off_t)Record[4], (time_t)Record[5]) @@ -1709,7 +1709,7 @@ const FileEntry *ASTReader::getFileEntry(StringRef filenameStrRef) { std::string Filename = filenameStrRef; - MaybeAddSystemRootToFilename(Filename); + MaybeAddSystemRootToFilename(ModuleMgr.getPrimaryModule(), Filename); const FileEntry *File = FileMgr.getFile(Filename); if (File == 0 && !OriginalDir.empty() && !CurrentDir.empty() && OriginalDir != CurrentDir) { @@ -1726,9 +1726,10 @@ /// \brief If we are loading a relocatable PCH file, and the filename is /// not an absolute path, add the system root to the beginning of the file /// name. -void ASTReader::MaybeAddSystemRootToFilename(std::string &Filename) { +void ASTReader::MaybeAddSystemRootToFilename(ModuleFile &M, + std::string &Filename) { // If this is not a relocatable PCH file, there's nothing to do. - if (!RelocatablePCH) + if (!M.RelocatablePCH) return; if (Filename.empty() || llvm::sys::path::is_absolute(Filename)) @@ -1802,7 +1803,7 @@ return IgnorePCH; } - RelocatablePCH = Record[4]; + F.RelocatablePCH = Record[4]; const std::string &CurBranch = getClangFullRepositoryVersion(); StringRef ASTBranch(BlobStart, BlobLen); @@ -1869,7 +1870,7 @@ F.OriginalSourceFileID = FileID::get(Record[0]); F.ActualOriginalSourceFileName.assign(BlobStart, BlobLen); F.OriginalSourceFileName = F.ActualOriginalSourceFileName; - MaybeAddSystemRootToFilename(F.OriginalSourceFileName); + MaybeAddSystemRootToFilename(F, F.OriginalSourceFileName); } break; @@ -6844,8 +6845,7 @@ SourceMgr(PP.getSourceManager()), FileMgr(PP.getFileManager()), Diags(PP.getDiagnostics()), SemaObj(0), PP(PP), Context(Context), Consumer(0), ModuleMgr(PP.getFileManager()), - RelocatablePCH(false), isysroot(isysroot), - DisableValidation(DisableValidation), + isysroot(isysroot), DisableValidation(DisableValidation), DisableStatCache(DisableStatCache), AllowASTWithCompilerErrors(AllowASTWithCompilerErrors), CurrentGeneration(0), CurrSwitchCaseStmts(&SwitchCaseStmts), _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits