Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.
Removed an unnecessary loop to get to setters incoming
argument. Added DoxyGen comments. Still more work
to do in this area (WIP).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79365 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6b597d1..a7cae8a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2342,13 +2342,11 @@
if (Getter)
PType = Getter->getResultType();
- else {
- for (ObjCMethodDecl::param_iterator PI = Setter->param_begin(),
- E = Setter->param_end(); PI != E; ++PI)
- PType = (*PI)->getType();
- }
+ else
+ // Get the expression type from Setter's incoming parameter.
+ PType = (*(Setter->param_end() -1))->getType();
// FIXME: we must check that the setter has property type.
- return Owned(new (Context) ObjCKVCRefExpr(Getter, PType,
+ return Owned(new (Context) ObjCImplctSetterGetterRefExpr(Getter, PType,
Setter, MemberLoc, BaseExpr));
}
return ExprError(Diag(MemberLoc, diag::err_property_not_found)
@@ -2535,13 +2533,11 @@
if (Getter)
PType = Getter->getResultType();
- else {
- for (ObjCMethodDecl::param_iterator PI = Setter->param_begin(),
- E = Setter->param_end(); PI != E; ++PI)
- PType = (*PI)->getType();
- }
+ else
+ // Get the expression type from Setter's incoming parameter.
+ PType = (*(Setter->param_end() -1))->getType();
// FIXME: we must check that the setter has property type.
- return Owned(new (Context) ObjCKVCRefExpr(Getter, PType,
+ return Owned(new (Context) ObjCImplctSetterGetterRefExpr(Getter, PType,
Setter, MemberLoc, BaseExpr));
}
return ExprError(Diag(MemberLoc, diag::err_property_not_found)
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 47ce949..553a32f 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -338,7 +338,8 @@
E = Setter->param_end(); PI != E; ++PI)
PType = (*PI)->getType();
}
- return Owned(new (Context) ObjCKVCRefExpr(Getter, PType, Setter,
+ return Owned(new (Context) ObjCImplctSetterGetterRefExpr(
+ Getter, PType, Setter,
propertyNameLoc, IFace, receiverNameLoc));
}
return ExprError(Diag(propertyNameLoc, diag::err_property_not_found)
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index d1bb0df..c5841e6 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -70,7 +70,7 @@
// cases now.
unsigned DiagID = diag::warn_unused_expr;
E = E->IgnoreParens();
- if (isa<ObjCKVCRefExpr>(E))
+ if (isa<ObjCImplctSetterGetterRefExpr>(E))
DiagID = diag::warn_unused_property_expr;
Diag(Loc, DiagID) << R1 << R2;
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 51db216..5516ab4 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -3409,7 +3409,8 @@
template<typename Derived>
Sema::OwningExprResult
-TreeTransform<Derived>::TransformObjCKVCRefExpr(ObjCKVCRefExpr *E) {
+TreeTransform<Derived>::TransformObjCImplctSetterGetterRefExpr(
+ ObjCImplctSetterGetterRefExpr *E) {
// FIXME: Implement this!
assert(false && "Cannot transform Objective-C expressions yet");
return SemaRef.Owned(E->Retain());