[LLVMbugs] [Bug 7495] New: LLVM/Clang does not allow ivar access for synthesised ivars without @synthesized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 25 12:12:09 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7495

           Summary: LLVM/Clang does not allow ivar access for synthesised
                    ivars without @synthesized
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: pilky at mcubedsw.com
                CC: llvmbugs at cs.uiuc.edu


I have been trying out some of the new Objective-C features available in Xcode
3.2.3 and the LLVM Compiler 1.5. Specifically the "@synthesize by default"
feature. I have added the -Xclang and -fobjc-nonfragile-abi2 flags and it all
works fine for the most part.

The only issue is that if you also want to have synthesised ivars. If you leave
both the ivar declaration and the @synthesize statement out then, while it does
generate the methods and seems to add the ivar, it throws up an errir when you
try to access the ivar directly.

I've included the code in question below (it is basically the standard Mac
Cocoa app template with a log put in and the @synthesize removed):


header
=========
#import <Cocoa/Cocoa.h>

@interface testAppDelegate : NSObject <NSApplicationDelegate> {
}

@property (assign) IBOutlet NSWindow *window;

@end


implementation
===========
#import "testAppDelegate.h"

@implementation testAppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSLog(@"test:%@", window);
}

@end


LLVM output
===========

/Users/_/Desktop/test/testAppDelegate.m:14:20: error: use of undeclared
identifier 'window'; did you mean 'cWindow'?
         NSLog(@"test:%@", window);
                           ^~~~~~
                           cWindow
In file included from /Users/_/Desktop/test/test_Prefix.pch:6:
In file included from
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:81:
In file included from
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLError.h:17:
In file included from
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21:
In file included from
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:41:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AERegistry.h:108:3:
note: 'cWindow' declared here
   cWindow                       = 'cwin', /*  0x6377696e  */
   ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list