Commit 13b8dc20 authored by Bill Wendling's avatar Bill Wendling
Browse files

Merging r214734:

------------------------------------------------------------------------
r214734 | ogoffart | 2014-08-04 10:28:05 -0700 (Mon, 04 Aug 2014) | 7 lines

Fix crash when assiging to a property with an invalid type

This is a regression from clang 3.4

Set the result to ExprError and returns true, rather than simply
returns false because errors have been reported already and returning
false show a confusing error
------------------------------------------------------------------------

llvm-svn: 214839
parent 6a183487
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -845,7 +845,12 @@ bool ObjCPropertyOpBuilder::tryBuildGetOfReference(Expr *op,
  if (!S.getLangOpts().CPlusPlus) return false;

  findGetter();
  assert(Getter && "property has no setter and no getter!");
  if (!Getter) {
    // The property has no setter and no getter! This can happen if the type is
    // invalid. Error have already been reported.
    result = ExprError();
    return true;
  }

  // Only do this if the getter returns an l-value reference type.
  QualType resultType = Getter->getReturnType();
+19 −0
Original line number Diff line number Diff line
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s

@interface I
{
  A* response; // expected-error {{unknown type name 'A'}}
}
@end
@interface I ()
@property A* response;  // expected-error {{unknown type name 'A'}}
@end
@implementation I
@synthesize response;
- (void) foo :(A*) a   // expected-error {{expected a type}}
{
  self.response = a;
}
@end