@@ -227,7 +227,6 @@ class ObjCIvarRefExpr : public Expr {
227227
228228// / ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC
229229// / property.
230- // /
231230class ObjCPropertyRefExpr : public Expr {
232231private:
233232 // / If the bool is true, this is an implicit property reference; the
@@ -237,6 +236,11 @@ class ObjCPropertyRefExpr : public Expr {
237236 llvm::PointerIntPair<NamedDecl*, 1 , bool > PropertyOrGetter;
238237 ObjCMethodDecl *Setter;
239238
239+ // FIXME: Maybe we should store the property identifier here,
240+ // because it's not rederivable from the other data when there's an
241+ // implicit property with no getter (because the 'foo' -> 'setFoo:'
242+ // transformation is lossy on the first character).
243+
240244 SourceLocation IdLoc;
241245
242246 // / \brief When the receiver in property access is 'super', this is
@@ -255,6 +259,7 @@ class ObjCPropertyRefExpr : public Expr {
255259 base->containsUnexpandedParameterPack()),
256260 PropertyOrGetter(PD, false ), Setter(0 ),
257261 IdLoc(l), ReceiverLoc(), Receiver(base) {
262+ assert (t->isSpecificPlaceholderType (BuiltinType::PseudoObject));
258263 }
259264
260265 ObjCPropertyRefExpr (ObjCPropertyDecl *PD, QualType t,
@@ -265,6 +270,7 @@ class ObjCPropertyRefExpr : public Expr {
265270 st->containsUnexpandedParameterPack()),
266271 PropertyOrGetter(PD, false ), Setter(0 ),
267272 IdLoc(l), ReceiverLoc(sl), Receiver(st.getTypePtr()) {
273+ assert (t->isSpecificPlaceholderType (BuiltinType::PseudoObject));
268274 }
269275
270276 ObjCPropertyRefExpr (ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
@@ -275,6 +281,7 @@ class ObjCPropertyRefExpr : public Expr {
275281 Base->containsUnexpandedParameterPack()),
276282 PropertyOrGetter(Getter, true ), Setter(Setter),
277283 IdLoc(IdLoc), ReceiverLoc(), Receiver(Base) {
284+ assert (T->isSpecificPlaceholderType (BuiltinType::PseudoObject));
278285 }
279286
280287 ObjCPropertyRefExpr (ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
@@ -284,6 +291,7 @@ class ObjCPropertyRefExpr : public Expr {
284291 : Expr(ObjCPropertyRefExprClass, T, VK, OK, false , false , false , false ),
285292 PropertyOrGetter(Getter, true ), Setter(Setter),
286293 IdLoc(IdLoc), ReceiverLoc(SuperLoc), Receiver(SuperTy.getTypePtr()) {
294+ assert (T->isSpecificPlaceholderType (BuiltinType::PseudoObject));
287295 }
288296
289297 ObjCPropertyRefExpr (ObjCMethodDecl *Getter, ObjCMethodDecl *Setter,
@@ -293,6 +301,7 @@ class ObjCPropertyRefExpr : public Expr {
293301 : Expr(ObjCPropertyRefExprClass, T, VK, OK, false , false , false , false ),
294302 PropertyOrGetter(Getter, true ), Setter(Setter),
295303 IdLoc(IdLoc), ReceiverLoc(ReceiverLoc), Receiver(Receiver) {
304+ assert (T->isSpecificPlaceholderType (BuiltinType::PseudoObject));
296305 }
297306
298307 explicit ObjCPropertyRefExpr (EmptyShell Empty)
@@ -348,14 +357,15 @@ class ObjCPropertyRefExpr : public Expr {
348357 if (const ObjCMethodDecl *Getter = PDecl->getGetterMethodDecl ())
349358 ResultType = Getter->getResultType ();
350359 else
351- ResultType = getType ();
360+ ResultType = PDecl-> getType ();
352361 } else {
353362 const ObjCMethodDecl *Getter = getImplicitPropertyGetter ();
354- ResultType = Getter->getResultType (); // with reference!
363+ if (Getter)
364+ ResultType = Getter->getResultType (); // with reference!
355365 }
356366 return ResultType;
357367 }
358-
368+
359369 QualType getSetterArgType () const {
360370 QualType ArgType;
361371 if (isImplicitProperty ()) {
0 commit comments