summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-28 05:42:38 +0000
committerChris Lattner <sabre@nondot.org>2009-01-28 05:42:38 +0000
commit64d8fc25d6d10df2c23131882da018c201f19c49 (patch)
treeecdad79ed548340a545e11a48f9fcb6cdb0d15a1 /clang
parent21114f21c4ac8c06a0aaad05f2e47f068610febc (diff)
downloadbcm5719-llvm-64d8fc25d6d10df2c23131882da018c201f19c49.tar.gz
bcm5719-llvm-64d8fc25d6d10df2c23131882da018c201f19c49.zip
fix a crash I introduced, thanks to Ted for the awesome reduced
testcase :) llvm-svn: 63182
Diffstat (limited to 'clang')
-rw-r--r--clang/Driver/DependencyFile.cpp7
-rw-r--r--clang/test/Driver/dependency-gen.c5
2 files changed, 10 insertions, 2 deletions
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;
diff --git a/clang/test/Driver/dependency-gen.c b/clang/test/Driver/dependency-gen.c
new file mode 100644
index 00000000000..ad9029f9f14
--- /dev/null
+++ b/clang/test/Driver/dependency-gen.c
@@ -0,0 +1,5 @@
+
+// rdar://6533411
+// RUN: clang -MD -MF /tmp/null.d -x c /dev/null
+
+
OpenPOWER on IntegriCloud