]> granicus.if.org Git - clang/commitdiff
fix a crash I introduced, thanks to Ted for the awesome reduced
authorChris Lattner <sabre@nondot.org>
Wed, 28 Jan 2009 05:42:38 +0000 (05:42 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 28 Jan 2009 05:42:38 +0000 (05:42 +0000)
testcase :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63182 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/DependencyFile.cpp
test/Driver/dependency-gen.c [new file with mode: 0644]

index 0d4ee91f01bb436569d1ac76f5cbd03c7bf6eff4..673ca0734a187dc96fda7d21b68ad723882d9364 100644 (file)
@@ -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;
 
diff --git a/test/Driver/dependency-gen.c b/test/Driver/dependency-gen.c
new file mode 100644 (file)
index 0000000..ad9029f
--- /dev/null
@@ -0,0 +1,5 @@
+
+// rdar://6533411
+// RUN: clang -MD -MF /tmp/null.d -x c /dev/null
+
+