ExprResult TransformBlockExpr(BlockExpr *E) { return Owned(E); }
- ExprResult TransformObjCPropertyRefExpr(ObjCPropertyRefExpr *E) {
- return Owned(E);
- }
-
- ExprResult TransformObjCIvarRefExpr(ObjCIvarRefExpr *E) {
- return Owned(E);
- }
-
ExprResult Transform(Expr *E) {
ExprResult Res;
while (true) {
ExprResult RebuildObjCIvarRefExpr(Expr *BaseArg, ObjCIvarDecl *Ivar,
SourceLocation IvarLoc,
bool IsArrow, bool IsFreeIvar) {
- // FIXME: We lose track of the IsFreeIvar bit.
CXXScopeSpec SS;
DeclarationNameInfo NameInfo(Ivar->getDeclName(), IvarLoc);
- return getSema().BuildMemberReferenceExpr(BaseArg, BaseArg->getType(),
- /*FIXME:*/IvarLoc, IsArrow,
- SS, SourceLocation(),
- /*FirstQualifierInScope=*/nullptr,
- NameInfo,
- /*TemplateArgs=*/nullptr,
- /*S=*/nullptr);
+ ExprResult Result = getSema().BuildMemberReferenceExpr(
+ BaseArg, BaseArg->getType(),
+ /*FIXME:*/ IvarLoc, IsArrow, SS, SourceLocation(),
+ /*FirstQualifierInScope=*/nullptr, NameInfo,
+ /*TemplateArgs=*/nullptr,
+ /*S=*/nullptr);
+ if (IsFreeIvar && Result.isUsable())
+ cast<ObjCIvarRefExpr>(Result.get())->setIsFreeIvar(IsFreeIvar);
+ return Result;
}
/// \brief Build a new Objective-C property reference expression.
self.m_prop2 = new ClassB(m_prop1); // expected-error {{use of undeclared identifier 'm_prop1'; did you mean '_m_prop1'?}}
}
@end
+
+// rdar://30310772
+
+@interface InvalidNameInIvarAndPropertyBase
+{
+@public
+ float _a;
+}
+@property float _b;
+@end
+
+void invalidNameInIvarAndPropertyBase() {
+ float a = ((InvalidNameInIvarAndPropertyBase*)node)->_a; // expected-error {{use of undeclared identifier 'node'}}
+ float b = ((InvalidNameInIvarAndPropertyBase*)node)._b; // expected-error {{use of undeclared identifier 'node'}}
+}