diff options
author | Alex Lorenz <arphaman@gmail.com> | 2019-08-27 01:03:25 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2019-08-27 01:03:25 +0000 |
commit | 681d5f14d9325c57a7fa041b1d51ea550d1f3b88 (patch) | |
tree | fc0e51465f27d95cc892be168f93605a73302d95 | |
parent | 03e14de04eb5ff392f549a757c7b535b0d02e4f5 (diff) |
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
-rw-r--r-- | clangd/ClangdUnit.cpp | 4 | ||||
-rw-r--r-- | pp-trace/PPCallbacksTracker.cpp | 4 | ||||
-rw-r--r-- | pp-trace/PPCallbacksTracker.h | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/clangd/ClangdUnit.cpp b/clangd/ClangdUnit.cpp index 82ca7eda..f85cac20 100644 --- a/clangd/ClangdUnit.cpp +++ b/clangd/ClangdUnit.cpp @@ -268,7 +268,9 @@ private: 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 4b8a658b..6000dcb3 100644 --- a/pp-trace/PPCallbacksTracker.cpp +++ b/pp-trace/PPCallbacksTracker.cpp @@ -112,11 +112,11 @@ void PPCallbacksTracker::FileChanged(SourceLocation Loc, // 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 726a393a..da5d1b68 100644 --- a/pp-trace/PPCallbacksTracker.h +++ b/pp-trace/PPCallbacksTracker.h @@ -89,7 +89,7 @@ public: 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; |