Use FileEntryRef for PPCallbacks::FileSkipped
This fixes the issue where a filename dependendency was missing if the file that
was skipped was included through a symlink in an earlier run, if the file
manager was reused between runs.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@369998 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/ClangdUnit.cpp b/clangd/ClangdUnit.cpp
index 82ca7ed..f85cac2 100644
--- a/clangd/ClangdUnit.cpp
+++ b/clangd/ClangdUnit.cpp
@@ -268,7 +268,9 @@
FilenameTok.getEndLoc()),
File, "SearchPath", "RelPath", /*Imported=*/nullptr, Inc.FileKind);
if (File)
- Delegate->FileSkipped(*File, FilenameTok, Inc.FileKind);
+ // FIXME: Use correctly named FileEntryRef.
+ Delegate->FileSkipped(FileEntryRef(File->getName(), *File), FilenameTok,
+ Inc.FileKind);
else {
llvm::SmallString<1> UnusedRecovery;
Delegate->FileNotFound(WrittenFilename, UnusedRecovery);
diff --git a/pp-trace/PPCallbacksTracker.cpp b/pp-trace/PPCallbacksTracker.cpp
index 4b8a658..6000dcb 100644
--- a/pp-trace/PPCallbacksTracker.cpp
+++ b/pp-trace/PPCallbacksTracker.cpp
@@ -112,11 +112,11 @@
// Callback invoked whenever a source file is skipped as the result
// of header guard optimization.
-void PPCallbacksTracker::FileSkipped(const FileEntry &SkippedFile,
+void PPCallbacksTracker::FileSkipped(const FileEntryRef &SkippedFile,
const Token &FilenameTok,
SrcMgr::CharacteristicKind FileType) {
beginCallback("FileSkipped");
- appendArgument("ParentFile", &SkippedFile);
+ appendArgument("ParentFile", &SkippedFile.getFileEntry());
appendArgument("FilenameTok", FilenameTok);
appendArgument("FileType", FileType, CharacteristicKindStrings);
}
diff --git a/pp-trace/PPCallbacksTracker.h b/pp-trace/PPCallbacksTracker.h
index 726a393..da5d1b6 100644
--- a/pp-trace/PPCallbacksTracker.h
+++ b/pp-trace/PPCallbacksTracker.h
@@ -89,7 +89,7 @@
void FileChanged(SourceLocation Loc, PPCallbacks::FileChangeReason Reason,
SrcMgr::CharacteristicKind FileType,
FileID PrevFID = FileID()) override;
- void FileSkipped(const FileEntry &SkippedFile, const Token &FilenameTok,
+ void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok,
SrcMgr::CharacteristicKind FileType) override;
bool FileNotFound(llvm::StringRef FileName,
llvm::SmallVectorImpl<char> &RecoveryPath) override;