[cfe-commits] r109753 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaObjCXX/references.mm

Douglas Gregor dgregor at apple.com
Thu Jul 29 09:05:45 PDT 2010


Author: dgregor
Date: Thu Jul 29 11:05:45 2010
New Revision: 109753

URL: http://llvm.org/viewvc/llvm-project?rev=109753&view=rev
Log:
When taking the address of a value of Objective-C object type (e.g.,
one because we're referencing a variable of type NSString &), the
resulting type is an ObjCObjectPointerType.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/SemaObjCXX/references.mm

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=109753&r1=109752&r2=109753&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jul 29 11:05:45 2010
@@ -6313,6 +6313,8 @@
   }
 
   // If the operand has type "type", the result has type "pointer to type".
+  if (op->getType()->isObjCObjectType())
+    return Context.getObjCObjectPointerType(op->getType());
   return Context.getPointerType(op->getType());
 }
 

Modified: cfe/trunk/test/SemaObjCXX/references.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/references.mm?rev=109753&r1=109752&r2=109753&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/references.mm (original)
+++ cfe/trunk/test/SemaObjCXX/references.mm Thu Jul 29 11:05:45 2010
@@ -24,3 +24,10 @@
   return f0(a.p1);	// expected-error {{property 'p1' not found on object of type 'A *'}}
 }
 
+// PR7740
+ at class NSString;
+
+void f3(id);
+void f4(NSString &tmpstr) {
+  f3(&tmpstr);
+}





More information about the cfe-commits mailing list