Check for null ObjCInterfaceDecls returned from getClassInterface() when generating USRs. While I have no test case for this (could not create one), this shows up in crash reports. Tentatively fixes <rdar://problem/8452791>.

llvm-svn: 114392
This commit is contained in:
Ted Kremenek 2010-09-21 04:45:46 +00:00
parent e3d864b857
commit c2eb0116cc
1 changed files with 11 additions and 4 deletions

View File

@ -286,10 +286,17 @@ void USRGenerator::VisitObjCMethodDecl(ObjCMethodDecl *D) {
do {
if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(container))
if (CD->IsClassExtension()) {
Visit(CD->getClassInterface());
break;
}
Visit(cast<Decl>(D->getDeclContext()));
// ID can be null with invalid code.
if (ObjCInterfaceDecl *ID = CD->getClassInterface()) {
Visit(ID);
break;
}
// Invalid code. Can't generate USR.
IgnoreResults = true;
return;
}
Visit(container);
}
while (false);