diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-07 18:47:10 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-12-07 18:47:10 +0000 |
| commit | 33c0e815f33a81cd9571b4da4c77a1fd0ef85974 (patch) | |
| tree | 090436f47e6a3dc715acc057eda71a5ece50872e /clang/test | |
| parent | bfd373a53e4836bd0c82d46402f81673bec75f03 (diff) | |
| download | bcm5719-llvm-33c0e815f33a81cd9571b4da4c77a1fd0ef85974.tar.gz bcm5719-llvm-33c0e815f33a81cd9571b4da4c77a1fd0ef85974.zip | |
Patch for rewriting of @protocol.
llvm-svn: 44681
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Sema/protocol-rewrite-1.m | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/test/Sema/protocol-rewrite-1.m b/clang/test/Sema/protocol-rewrite-1.m new file mode 100644 index 00000000000..a9df2ec7936 --- /dev/null +++ b/clang/test/Sema/protocol-rewrite-1.m @@ -0,0 +1,48 @@ +// RUN: clang -rewrite-test %s + +typedef struct MyWidget { + int a; +} MyWidget; + +MyWidget gWidget = { 17 }; + +@protocol MyProto +- (MyWidget *)widget; +@end + +@interface Foo +@end + +@interface Bar: Foo <MyProto> +@end + +@interface Container ++ (MyWidget *)elementForView:(Foo *)view; +@end + +@implementation Foo +@end + +@implementation Bar +- (MyWidget *)widget { + return &gWidget; +} +@end + +@implementation Container ++ (MyWidget *)elementForView:(Foo *)view +{ + MyWidget *widget = (void*)0; + if (@protocol(MyProto)) { + widget = [(id <MyProto>)view widget]; + } + return widget; +} +@end + +int main(void) { + id view; + MyWidget *w = [Container elementForView: view]; + + return 0; +} |

