diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-01-10 15:26:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-01-10 15:26:13 +0000 |
commit | c07e34ceedaab7e4cdfab5a62820f24168392004 (patch) | |
tree | 5f056971352b21f6d8441c3f8b0658d0e9299ed6 /clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | |
parent | a04d2b333055a342f419b8aa8a88fd47fc4e75df (diff) | |
download | bcm5719-llvm-c07e34ceedaab7e4cdfab5a62820f24168392004.tar.gz bcm5719-llvm-c07e34ceedaab7e4cdfab5a62820f24168392004.zip |
Make PathDiagnosticLocation more resilient to null Stmt pointers.
llvm-svn: 147854
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 50ebe3b7466..e398bae60fc 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -237,9 +237,15 @@ FullSourceLoc case RangeK: break; case StmtK: + // Defensive checking. + if (!S) + break; return FullSourceLoc(getValidSourceLocation(S, LAC), const_cast<SourceManager&>(*SM)); case DeclK: + // Defensive checking. + if (!D) + break; return FullSourceLoc(D->getLocation(), const_cast<SourceManager&>(*SM)); } |