de-sugared when accessing property reference type.
Add a test case for synthesize ivar. // rdar://9070460


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128554 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 43e3027..95a365c 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -540,7 +540,7 @@
       ParmVarDecl *Param = (*P);
       QualType T = Param->getType();
       if (T->isReferenceType())
-        T = cast<ReferenceType>(T)->getPointeeType();
+        T = T->getAs<ReferenceType>()->getPointeeType();
       Expr *rhs = new (Context) DeclRefExpr(Param, T,
                                             VK_LValue, SourceLocation());
       ExprResult Res = BuildBinOp(S, lhs->getLocEnd(),