diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
| commit | b60736ec1405bb0a8dd40989f67ef4c93da068ab (patch) | |
| tree | 5c43fbb7c9fc45f0f87e0e6795a86267dbd12f9d /clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | |
| parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
Diffstat (limited to 'clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp')
| -rw-r--r-- | clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp index 4f6eff799f22..f74ce7304df5 100644 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -77,15 +77,10 @@ void ModuleDepCollectorPP::FileChanged(SourceLocation Loc, // Dependency generation really does want to go all the way to the // file entry for a source location to find out what is depended on. // We do not want #line markers to affect dependency generation! - Optional<FileEntryRef> File = - SM.getFileEntryRefForID(SM.getFileID(SM.getExpansionLoc(Loc))); - if (!File) - return; - - StringRef FileName = - llvm::sys::path::remove_leading_dotslash(File->getName()); - - MDC.MainDeps.push_back(std::string(FileName)); + if (Optional<StringRef> Filename = + SM.getNonBuiltinFilenameForID(SM.getFileID(SM.getExpansionLoc(Loc)))) + MDC.MainDeps.push_back( + std::string(llvm::sys::path::remove_leading_dotslash(*Filename))); } void ModuleDepCollectorPP::InclusionDirective( |
