]> granicus.if.org Git - clang/commitdiff
Prevent crash on multiple user errors (which I cannot reproduce in
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Feb 2013 17:22:23 +0000 (17:22 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 18 Feb 2013 17:22:23 +0000 (17:22 +0000)
a small test case). // rdar://13178483.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175450 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp

index 933105e6281154e3048cea056819ce984d5a120c..86bd7b85cc13c1b419a594bbe3205460bc4712fb 100644 (file)
@@ -1976,6 +1976,10 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
                          IdentifierInfo *II, bool AllowBuiltinCreation) {
   SourceLocation Loc = Lookup.getNameLoc();
   ObjCMethodDecl *CurMethod = getCurMethodDecl();
+  
+  // Check for error condition which is already reported.
+  if (!CurMethod)
+    return ExprError();
 
   // There are two cases to handle here.  1) scoped lookup could have failed,
   // in which case we should look for an ivar.  2) scoped lookup could have