Created
April 4, 2014 22:23
-
-
Save bolinfest/9984257 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- example.h ---- | |
#import <Foundation/Foundation.h> | |
#ifndef __has_feature // Optional. | |
#define __has_feature(x) 0 // Compatibility with non-clang compilers. | |
#endif | |
#ifndef NS_RETURNS_NOT_RETAINED | |
#if __has_feature(attribute_ns_returns_not_retained) | |
#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) | |
#else | |
#define NS_RETURNS_NOT_RETAINED | |
#endif | |
#endif | |
extern NSString *someFunction1(void) NS_RETURNS_NOT_RETAINED; | |
extern NSString *someFunction2(void) NS_RETURNS_NOT_RETAINED; | |
---- example.m ---- | |
#import "example.h" | |
NSString *someFunction1() | |
{ | |
return @"someFunction1"; | |
} | |
NSString *someFunction2() | |
{ | |
return @"someFunction2"; | |
} | |
---- compilation ---- | |
$ clang -framework Foundation -Xclang -ast-dump example.m | grep someFunction | |
|-FunctionDecl 0x10450ca90 <./example.h:15:1, /System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:137:72> someFunction1 'NSString *(void)' extern | |
|-FunctionDecl 0x10450cc00 <./example.h:16:1, /System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:137:72> someFunction2 'NSString *(void)' extern | |
|-FunctionDecl 0x10450cd30 <example.m:3:1, line:6:1> someFunction1 'NSString *(void)' | |
| | `-StringLiteral 0x10450ce18 <col:11> 'char [14]' lvalue "someFunction1" | |
`-FunctionDecl 0x10450cee0 <example.m:8:1, line:11:1> someFunction2 'NSString *(void)' | |
| `-StringLiteral 0x10450cfc8 <col:11> 'char [14]' lvalue "someFunction2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment