From 64d8fc25d6d10df2c23131882da018c201f19c49 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 28 Jan 2009 05:42:38 +0000 Subject: fix a crash I introduced, thanks to Ted for the awesome reduced testcase :) llvm-svn: 63182 --- clang/Driver/DependencyFile.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/Driver/DependencyFile.cpp') diff --git a/clang/Driver/DependencyFile.cpp b/clang/Driver/DependencyFile.cpp index 0d4ee91f01b..673ca0734a1 100644 --- a/clang/Driver/DependencyFile.cpp +++ b/clang/Driver/DependencyFile.cpp @@ -174,8 +174,11 @@ void DependencyFileCallback::FileChanged(SourceLocation Loc, // #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; -- cgit v1.2.3