diff options
| author | Jan Korous <jkorous@apple.com> | 2019-02-14 23:02:35 +0000 |
|---|---|---|
| committer | Jan Korous <jkorous@apple.com> | 2019-02-14 23:02:35 +0000 |
| commit | 85eb363d56d40b83880d310a1b53855a68e873c9 (patch) | |
| tree | 0961300b38a0edd27ce2606e2d47a2a6627f6f1b /clang/lib | |
| parent | d5b017d601b483553f314db36c23aa1c11e0bb78 (diff) | |
| download | bcm5719-llvm-85eb363d56d40b83880d310a1b53855a68e873c9.tar.gz bcm5719-llvm-85eb363d56d40b83880d310a1b53855a68e873c9.zip | |
[clang][FileManager] fillRealPathName even if we aren't opening the file
The pathname wasn't previously filled when the getFile() method was called with openFile = false.
We are caching FileEntry-s in ParsedAST::Includes in clangd and this caused the problem.
This fixes an internal test failure in clangd - ClangdTests.GoToInclude.All
rdar://47536127
Differential Revision: https://reviews.llvm.org/D58213
llvm-svn: 354075
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Basic/FileManager.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 75caff95559..41026763377 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -267,6 +267,9 @@ const FileEntry *FileManager::getFile(StringRef Filename, bool openFile, if (UFE.File) { if (auto PathName = UFE.File->getName()) fillRealPathName(&UFE, *PathName); + } else if (!openFile) { + // We should still fill the path even if we aren't opening the file. + fillRealPathName(&UFE, InterndFileName); } return &UFE; } |

