forked from OSchip/llvm-project
Move OriginalDir from ASTReader to ModuleFile.
llvm-svn: 166233
This commit is contained in:
parent
d45a6b93df
commit
451dffaf64
|
@ -645,10 +645,6 @@ private:
|
||||||
SmallVector<serialization::SubmoduleID, 2> ImportedModules;
|
SmallVector<serialization::SubmoduleID, 2> ImportedModules;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \brief The directory that the PCH was originally created in. Used to
|
|
||||||
/// allow resolving headers even after headers+PCH was moved to a new path.
|
|
||||||
std::string OriginalDir;
|
|
||||||
|
|
||||||
/// \brief The directory that the PCH we are reading is stored in.
|
/// \brief The directory that the PCH we are reading is stored in.
|
||||||
std::string CurrentDir;
|
std::string CurrentDir;
|
||||||
|
|
||||||
|
|
|
@ -1130,10 +1130,10 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) {
|
||||||
OverriddenBuffer? FileMgr.getVirtualFile(Filename, (off_t)Record[4],
|
OverriddenBuffer? FileMgr.getVirtualFile(Filename, (off_t)Record[4],
|
||||||
(time_t)Record[5])
|
(time_t)Record[5])
|
||||||
: FileMgr.getFile(Filename, /*OpenFile=*/false);
|
: FileMgr.getFile(Filename, /*OpenFile=*/false);
|
||||||
if (File == 0 && !OriginalDir.empty() && !CurrentDir.empty() &&
|
if (File == 0 && !F->OriginalDir.empty() && !CurrentDir.empty() &&
|
||||||
OriginalDir != CurrentDir) {
|
F->OriginalDir != CurrentDir) {
|
||||||
std::string resolved = resolveFileRelativeToOriginalDir(Filename,
|
std::string resolved = resolveFileRelativeToOriginalDir(Filename,
|
||||||
OriginalDir,
|
F->OriginalDir,
|
||||||
CurrentDir);
|
CurrentDir);
|
||||||
if (!resolved.empty())
|
if (!resolved.empty())
|
||||||
File = FileMgr.getFile(resolved);
|
File = FileMgr.getFile(resolved);
|
||||||
|
@ -1708,13 +1708,14 @@ void ASTReader::markIdentifierUpToDate(IdentifierInfo *II) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileEntry *ASTReader::getFileEntry(StringRef filenameStrRef) {
|
const FileEntry *ASTReader::getFileEntry(StringRef filenameStrRef) {
|
||||||
|
ModuleFile &M = ModuleMgr.getPrimaryModule();
|
||||||
std::string Filename = filenameStrRef;
|
std::string Filename = filenameStrRef;
|
||||||
MaybeAddSystemRootToFilename(ModuleMgr.getPrimaryModule(), Filename);
|
MaybeAddSystemRootToFilename(M, Filename);
|
||||||
const FileEntry *File = FileMgr.getFile(Filename);
|
const FileEntry *File = FileMgr.getFile(Filename);
|
||||||
if (File == 0 && !OriginalDir.empty() && !CurrentDir.empty() &&
|
if (File == 0 && !M.OriginalDir.empty() && !CurrentDir.empty() &&
|
||||||
OriginalDir != CurrentDir) {
|
M.OriginalDir != CurrentDir) {
|
||||||
std::string resolved = resolveFileRelativeToOriginalDir(Filename,
|
std::string resolved = resolveFileRelativeToOriginalDir(Filename,
|
||||||
OriginalDir,
|
M.OriginalDir,
|
||||||
CurrentDir);
|
CurrentDir);
|
||||||
if (!resolved.empty())
|
if (!resolved.empty())
|
||||||
File = FileMgr.getFile(resolved);
|
File = FileMgr.getFile(resolved);
|
||||||
|
@ -1865,20 +1866,14 @@ ASTReader::ASTReadResult ASTReader::ReadControlBlock(ModuleFile &F,
|
||||||
}
|
}
|
||||||
|
|
||||||
case ORIGINAL_FILE:
|
case ORIGINAL_FILE:
|
||||||
// Only record from the primary AST file.
|
|
||||||
if (&F == *ModuleMgr.begin()) {
|
|
||||||
F.OriginalSourceFileID = FileID::get(Record[0]);
|
F.OriginalSourceFileID = FileID::get(Record[0]);
|
||||||
F.ActualOriginalSourceFileName.assign(BlobStart, BlobLen);
|
F.ActualOriginalSourceFileName.assign(BlobStart, BlobLen);
|
||||||
F.OriginalSourceFileName = F.ActualOriginalSourceFileName;
|
F.OriginalSourceFileName = F.ActualOriginalSourceFileName;
|
||||||
MaybeAddSystemRootToFilename(F, F.OriginalSourceFileName);
|
MaybeAddSystemRootToFilename(F, F.OriginalSourceFileName);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ORIGINAL_PCH_DIR:
|
case ORIGINAL_PCH_DIR:
|
||||||
// Only record from the primary AST file.
|
F.OriginalDir.assign(BlobStart, BlobLen);
|
||||||
if (&F == *ModuleMgr.begin()) {
|
|
||||||
OriginalDir.assign(BlobStart, BlobLen);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue