fix a crash I introduced, thanks to Ted for the awesome reduced
testcase :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63182 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/DependencyFile.cpp b/Driver/DependencyFile.cpp
index 0d4ee91..673ca07 100644
--- a/Driver/DependencyFile.cpp
+++ b/Driver/DependencyFile.cpp
@@ -174,8 +174,11 @@
// #line markers to affect dependency generation!
SourceManager &SM = PP->getSourceManager();
- FileID FID = SM.getFileID(SM.getInstantiationLoc(Loc));
- const char *Filename = SM.getFileEntryForID(FID)->getName();
+ const FileEntry *FE =
+ SM.getFileEntryForID(SM.getFileID(SM.getInstantiationLoc(Loc)));
+ if (FE == 0) return;
+
+ const char *Filename = FE->getName();
if (!FileMatchesDepCriteria(Filename, FileType))
return;