* lto.c (do_stream_out): Add PART parameter; open dump file.
[official-gcc.git] / gcc / testsuite / obj-c++.dg / objc-gc-3.mm
blob430e5832eb6c02e5be2d250be227f4cf2a827cf8
1 /* Test looking up fields in superclasses in the context of write-barriers
2    (where component references get rewritten).  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>  */
5 /* { dg-do compile } */
6 /* { dg-options "-fobjc-gc" } */
7 /* { dg-prune-output "cc1objplus: warning: '-fobjc-gc' is ignored for '-fgnu-runtime'" } */
9 #include "../objc-obj-c++-shared/TestsuiteObject.h"
10 #include "../objc-obj-c++-shared/runtime.h"
12 @class MyWindow;
14 @interface MyDocument : TestsuiteObject {
15     MyWindow *_window;
17 @end
19 @interface MyFileDocument : MyDocument {
20      struct {
21         unsigned int autoClose:1;
22         unsigned int openForUI:1;
23         unsigned int isClosing:1;
24         unsigned int needsDiskCheck:1;
25         unsigned int isWritable:1;
26         unsigned int representsFileOnDisk:1;
27         unsigned int RESERVED:26;
28     } _fdFlags;
30 @end
32 @interface MyTextFileDocument : MyFileDocument {
33     TestsuiteObject *_textStorage;
34     struct __tfdFlags {
35         unsigned int immutable:1;
36         unsigned int lineEnding:2;
37         unsigned int isClosing:1;
38         unsigned int settingsAreSet:1;
39         unsigned int usesTabs:1;
40         unsigned int isUTF8WithBOM:1;
41         unsigned int wrapsLines:1;
42         unsigned int usingDefaultLanguage:1;
43         unsigned int RESERVED:23;
44     } _tfdFlags;
45     int _tabWidth;
46     int _indentWidth;
48 @end
50 @interface MyRTFFileDocument : MyTextFileDocument
51 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type;
52 @end
54 @implementation MyRTFFileDocument
55 - (BOOL)readFromFile:(const char *)fileName ofType:(const char *)type {
56         if (_textStorage && fileName) {
57             [_textStorage free];
58             return YES;
59         } else if (type) {
60             _textStorage = [MyRTFFileDocument new];
61             return NO;
62         }
63    return (fileName && type);
65 @end