diff options
| author | Ted Kremenek <kremenek@apple.com> | 2010-09-21 04:45:46 +0000 | 
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2010-09-21 04:45:46 +0000 | 
| commit | c2eb0116ccab71ac4ba3f65bffb547616bcf00e7 (patch) | |
| tree | f49e054279230ea75dfa85bc25b90d163822bb2e | |
| parent | e3d864b85799e40d751f43fb5aec6c4872f6b94f (diff) | |
| download | bcm5719-llvm-c2eb0116ccab71ac4ba3f65bffb547616bcf00e7.tar.gz bcm5719-llvm-c2eb0116ccab71ac4ba3f65bffb547616bcf00e7.zip  | |
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
| -rw-r--r-- | clang/tools/libclang/CIndexUSRs.cpp | 15 | 
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index 554165754ac..4f23e59ec20 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -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);  | 

