/// Compute the relative path that names the given file relative to
/// the given directory.
static void computeRelativePath(FileManager &FM, const DirectoryEntry *Dir,
- const FileEntry *File,
- SmallString<128> &Result) {
+ FileEntryRef File, SmallString<128> &Result) {
Result.clear();
- StringRef FilePath = File->getDir()->getName();
+ StringRef FilePath = File.getDir().getName();
StringRef Path = FilePath;
while (!Path.empty()) {
if (auto CurDir = FM.getDirectory(Path)) {
if (*CurDir == Dir) {
Result = FilePath.substr(Path.size());
llvm::sys::path::append(Result,
- llvm::sys::path::filename(File->getName()));
+ llvm::sys::path::filename(File.getName()));
return;
}
}
Path = llvm::sys::path::parent_path(Path);
}
- Result = File->getName();
+ Result = File.getName();
}
void Preprocessor::PropagateLineStartLeadingSpaceInfo(Token &Result) {
.Default(false))
continue;
- if (auto Header = getFileManager().getFile(Entry->path()))
+ if (auto Header = getFileManager().getOptionalFileRef(Entry->path()))
if (!getSourceManager().hasFileInfo(*Header)) {
if (!ModMap.isHeaderInUnavailableModule(*Header)) {
// Find the relative path that would access this header.