aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-06-28 20:32:40 +0000
committerTed Kremenek <kremenek@apple.com>2010-06-28 20:32:40 +0000
commitea78375ed47f9d397f8415cc9cadd52ea406080c (patch)
tree8eb5f6d7ee1f80ea61b754c16ccf084c1a9ca5a4 /clang/lib/Frontend/InitPreprocessor.cpp
parentee6e29aa72287b928a02387d1d95deee767af6cc (diff)
downloadllvm-ea78375ed47f9d397f8415cc9cadd52ea406080c.zip
llvm-ea78375ed47f9d397f8415cc9cadd52ea406080c.tar.gz
llvm-ea78375ed47f9d397f8415cc9cadd52ea406080c.tar.bz2
Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
llvm-svn: 107061
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index c9c76e5..349dd7b 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -84,7 +84,8 @@ static void AddImplicitIncludePTH(MacroBuilder &Builder, Preprocessor &PP,
llvm::StringRef ImplicitIncludePTH) {
PTHManager *P = PP.getPTHManager();
assert(P && "No PTHManager.");
- const char *OriginalFile = P->getOriginalSourceFile();
+ // Null check 'P' in the corner case where it couldn't be created.
+ const char *OriginalFile = P ? P->getOriginalSourceFile() : 0;
if (!OriginalFile) {
PP.getDiagnostics().Report(diag::err_fe_pth_file_has_no_source_header)