[cfe-commits] r107061 - /cfe/trunk/lib/Frontend/InitPreprocessor.cpp
Ted Kremenek
kremenek at apple.com
Mon Jun 28 13:32:40 PDT 2010
Author: kremenek
Date: Mon Jun 28 15:32:40 2010
New Revision: 107061
URL: http://llvm.org/viewvc/llvm-project?rev=107061&view=rev
Log:
Don't crash in InitializePreprocessor() when there is no valid PTHManager. Fixes <rdar://problem/8098441>.
Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=107061&r1=107060&r2=107061&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Jun 28 15:32:40 2010
@@ -84,7 +84,8 @@
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)
More information about the cfe-commits
mailing list