[cfe-commits] r51800 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/objc-property-6.m

Steve Naroff snaroff at apple.com
Fri May 30 16:23:17 PDT 2008


Author: snaroff
Date: Fri May 30 18:23:16 2008
New Revision: 51800

URL: http://llvm.org/viewvc/llvm-project?rev=51800&view=rev
Log:
Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.

Added:
    cfe/trunk/test/Sema/objc-property-6.m
Modified:
    cfe/trunk/lib/AST/Expr.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=51800&r1=51799&r2=51800&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Fri May 30 18:23:16 2008
@@ -405,6 +405,8 @@
     return LV_Valid;
   case ObjCIvarRefExprClass: // ObjC instance variables are lvalues.
     return LV_Valid;
+  case ObjCPropertyRefExprClass: // FIXME: check if read-only property.
+    return LV_Valid;
   case PreDefinedExprClass:
     return LV_Valid;
   case CXXDefaultArgExprClass:

Added: cfe/trunk/test/Sema/objc-property-6.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/objc-property-6.m?rev=51800&view=auto

==============================================================================
--- cfe/trunk/test/Sema/objc-property-6.m (added)
+++ cfe/trunk/test/Sema/objc-property-6.m Fri May 30 18:23:16 2008
@@ -0,0 +1,69 @@
+// RUN: clang -fsyntax-only -verify %s
+# 1 "<command line>"
+# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
+typedef signed char BOOL;
+typedef unsigned int NSUInteger;
+typedef struct _NSZone NSZone;
+
+ at class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
+
+ at protocol NSObject
+- (BOOL)isEqual:(id)object;
++ class;
+ at end
+
+ at protocol NSCopying 
+- (id)copyWithZone:(NSZone *)zone;
+ at end
+
+ at protocol NSMutableCopying
+- (id)mutableCopyWithZone:(NSZone *)zone;
+ at end
+
+ at protocol NSCoding
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+ at end
+
+ at interface NSObject <NSObject> {}
+ at end
+
+typedef struct {} NSFastEnumerationState;
+
+ at protocol NSFastEnumeration 
+- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
+ at end
+
+ at interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>
+- (NSUInteger)count;
+ at end
+
+ at interface NSMutableArray : NSArray
+- (void)addObject:(id)anObject;
++ (id)arrayWithCapacity:(int)numItems;
+ at end
+
+ at interface NSBundle : NSObject {}
++ (NSBundle *)bundleForClass:(Class)aClass;
+- (NSString *)bundlePath;
+- (void)setBundlePath:(NSString *)x;
+ at end
+
+ at interface NSException : NSObject <NSCopying, NSCoding> {}
+ at end
+
+ at class NSArray, NSDictionary, NSError, NSString, NSURL;
+
+ at interface DTPlugInManager : NSObject
+ at end
+
+ at implementation DTPlugInManager
++ (DTPlugInManager *)defaultPlugInManager {
+  @try {
+    NSMutableArray *plugInPaths = [NSMutableArray arrayWithCapacity:100];
+    NSBundle *frameworkBundle = [NSBundle bundleForClass:[DTPlugInManager class]];
+    frameworkBundle.bundlePath = 0;
+    [plugInPaths addObject:frameworkBundle.bundlePath];
+  }
+  @catch (NSException *exception) {}
+}
+ at end





More information about the cfe-commits mailing list