diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 9 | ||||
-rw-r--r-- | clang/test/FixIt/typo-crash.m | 6 | ||||
-rw-r--r-- | clang/test/FixIt/typo.m | 2 |
3 files changed, 13 insertions, 4 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 diff --git a/clang/test/FixIt/typo-crash.m b/clang/test/FixIt/typo-crash.m new file mode 100644 index 00000000000..f10fe61ae78 --- /dev/null +++ b/clang/test/FixIt/typo-crash.m @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// <rdar://problem/7605289> +@implementation Unknown (Blarg) // expected-error{{cannot find interface declaration for 'Unknown'}} +- (int)method { return ivar; } // expected-error{{use of undeclared identifier 'ivar'}} +@end diff --git a/clang/test/FixIt/typo.m b/clang/test/FixIt/typo.m index c2069dd4169..86dd383c904 100644 --- a/clang/test/FixIt/typo.m +++ b/clang/test/FixIt/typo.m @@ -86,5 +86,5 @@ void test2(Collide *a) { - (int)send:(void*)buffer bytes:(int)bytes; @end -@interface IPv8 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}} +@interface IPv6 <Network_Socket> // expected-error{{cannot find protocol declaration for 'Network_Socket'; did you mean 'NetworkSocket'?}} @end |