diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-04 23:42:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-04 23:42:48 +0000 |
commit | 0c8a172911f9e8029d77511dbe59c810fb46ea14 (patch) | |
tree | b17aa3af6c54ba0bc0025f6af261ba5a9616626f /clang/lib | |
parent | 27dfb1e1a4e6d3c36e0ade15792dbd1487c7a931 (diff) | |
download | bcm5719-llvm-0c8a172911f9e8029d77511dbe59c810fb46ea14.tar.gz bcm5719-llvm-0c8a172911f9e8029d77511dbe59c810fb46ea14.zip |
Fix a crash with ill-formed code within a method in an ill-formed
category implementation, which showed up during (attempted) typo
correction. Fixes <rdar://problem/7605289>.
llvm-svn: 95334
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index c4b261fad44..af1b8a276ef 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2027,6 +2027,9 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, bool InBaseClass, VisibleDeclConsumer &Consumer, VisibleDeclsRecord &Visited) { + if (!Ctx) + return; + // Make sure we don't visit the same context twice. if (Visited.visitedContext(Ctx->getPrimaryContext())) return; @@ -2183,9 +2186,9 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result, // For instance methods, look for ivars in the method's interface. LookupResult IvarResult(Result.getSema(), Result.getLookupName(), Result.getNameLoc(), Sema::LookupMemberName); - ObjCInterfaceDecl *IFace = Method->getClassInterface(); - LookupVisibleDecls(IFace, IvarResult, /*QualifiedNameLookup=*/false, - /*InBaseClass=*/false, Consumer, Visited); + if (ObjCInterfaceDecl *IFace = Method->getClassInterface()) + LookupVisibleDecls(IFace, IvarResult, /*QualifiedNameLookup=*/false, + /*InBaseClass=*/false, Consumer, Visited); } // We've already performed all of the name lookup that we need |