[cfe-commits] r154667 - in /cfe/trunk: lib/Sema/SemaPseudoObject.cpp test/SemaObjCXX/property-reference.mm
Douglas Gregor
dgregor at apple.com
Fri Apr 13 08:53:08 PDT 2012
Author: dgregor
Date: Fri Apr 13 10:53:08 2012
New Revision: 154667
URL: http://llvm.org/viewvc/llvm-project?rev=154667&view=rev
Log:
super and class property reference expressions don't need to be
rebuilt. Fixes <rdar://problem/11052352>.
Modified:
cfe/trunk/lib/Sema/SemaPseudoObject.cpp
cfe/trunk/test/SemaObjCXX/property-reference.mm
Modified: cfe/trunk/lib/Sema/SemaPseudoObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaPseudoObject.cpp?rev=154667&r1=154666&r2=154667&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/trunk/lib/Sema/SemaPseudoObject.cpp Fri Apr 13 10:53:08 2012
@@ -1300,8 +1300,13 @@
Expr *opaqueRef = E->IgnoreParens();
if (ObjCPropertyRefExpr *refExpr
= dyn_cast<ObjCPropertyRefExpr>(opaqueRef)) {
- OpaqueValueExpr *baseOVE = cast<OpaqueValueExpr>(refExpr->getBase());
- return ObjCPropertyRefRebuilder(S, baseOVE->getSourceExpr()).rebuild(E);
+ if (refExpr->isObjectReceiver()) {
+ OpaqueValueExpr *baseOVE = cast<OpaqueValueExpr>(refExpr->getBase());
+ return ObjCPropertyRefRebuilder(S, baseOVE->getSourceExpr()).rebuild(E);
+ }
+
+ // Neither class or super property references need a rebuild.
+ return E;
} else if (ObjCSubscriptRefExpr *refExpr
= dyn_cast<ObjCSubscriptRefExpr>(opaqueRef)) {
OpaqueValueExpr *baseOVE = cast<OpaqueValueExpr>(refExpr->getBaseExpr());
Modified: cfe/trunk/test/SemaObjCXX/property-reference.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-reference.mm?rev=154667&r1=154666&r2=154667&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-reference.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-reference.mm Fri Apr 13 10:53:08 2012
@@ -42,3 +42,18 @@
cppObjectNonAtomic = cppObject;
}
@end
+
+
+// <rdar://problem/11052352>
+ at interface NSObject
++ alloc;
+- init;
+- class;
+ at end
+
+template<typename T> void f() {
+ NSObject *o = [NSObject.alloc init];
+ [o class];
+}
+
+template void f<int>();
More information about the cfe-commits
mailing list