aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp')
-rw-r--r--clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp13
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(