Author: compnerd Date: Sat Feb 6 20:30:55 2016 New Revision: 260016 URL: http://llvm.org/viewvc/llvm-project?rev=260016&view=rev Log: Sema: handle typo correction with ARC'ed objc properties
We would previously assert in findCapturingExpr when performing a typo correction resulting in an assignment of an ObjC property with a strong lifetype specifier due to the expression not being rooted in the file (invalid SLoc) during the retain cycle check on the typo-corrected expression. Handle the expression type appropriately during the TreeTransform to ensure that we have a source location associated with the expression. Fixes PR26486. Added: cfe/trunk/test/SemaObjC/typo-correction-arc.m Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=260016&r1=260015&r2=260016&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sat Feb 6 20:30:55 2016 @@ -6586,6 +6586,10 @@ public: ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); } + ExprResult TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { + return Owned(E); + } + ExprResult Transform(Expr *E) { ExprResult Res; while (true) { Added: cfe/trunk/test/SemaObjC/typo-correction-arc.m URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/typo-correction-arc.m?rev=260016&view=auto ============================================================================== --- cfe/trunk/test/SemaObjC/typo-correction-arc.m (added) +++ cfe/trunk/test/SemaObjC/typo-correction-arc.m Sat Feb 6 20:30:55 2016 @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -triple i386-apple-macosx10.10 -fobjc-arc -fsyntax-only -Wno-objc-root-class %s -verify + +typedef unsigned long NSUInteger; + +@interface NSArray +- (instancetype)initWithObjects:(const id[])objects count:(NSUInteger)count; +@end + +@interface I +@property NSArray *array; +@end + +@interface J +- (void)setArray:(id)array; +@end + +@implementation J { + I *i; +} +- (void)setArray:(id)array { // expected-note{{'array' declared here}} + i.array = aray; // expected-error{{use of undeclared identifier 'aray'; did you mean 'array'}} +} +@end + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits