diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-06-28 20:32:40 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-06-28 20:32:40 +0000 |
commit | 4ae4c919205307c6e98e6c920aa55019040cbe77 (patch) | |
tree | 254fe9235577adaac008d84dc4d1a20a64db5f55 /lib/Frontend/InitPreprocessor.cpp | |
parent | dce5ad0cf70ba74e1ecdbb5e81f1a81d97821636 (diff) |
Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | lib/Frontend/InitPreprocessor.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index c9c76e5f1f..349dd7bf98 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/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) |