Guard in USRGenerator::GenLoc() against null Decl* from invalid code.

llvm-svn: 130541
This commit is contained in:
Ted Kremenek 2011-04-29 21:35:23 +00:00
parent dd937843d3
commit 491da68ef9
1 changed files with 6 additions and 0 deletions

View File

@ -470,6 +470,12 @@ bool USRGenerator::GenLoc(const Decl *D) {
if (generatedLoc)
return IgnoreResults;
generatedLoc = true;
// Guard against null declarations in invalid code.
if (!D) {
IgnoreResults = true;
return true;
}
const SourceManager &SM = AU->getSourceManager();
SourceLocation L = D->getLocStart();