File tree Expand file tree Collapse file tree 6 files changed +26
-7
lines changed Expand file tree Collapse file tree 6 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,8 @@ set(libobjc_HDRS
99
99
objc/objc.h
100
100
objc/runtime-deprecated.h
101
101
objc/runtime.h
102
- objc/slot.h )
102
+ objc/slot.h
103
+ ${PROJECT_BINARY_DIR} /objc/objc-config.h )
103
104
104
105
set (libobjc_CXX_SRCS
105
106
selector_table.cc
@@ -150,6 +151,9 @@ add_compile_definitions($<$<BOOL:${ENABLE_TRACING}>:WITH_TRACING=1>)
150
151
add_compile_definitions ($< $< BOOL:${DEBUG_ARC_COMPAT} > :DEBUG_ARC_COMPAT> )
151
152
add_compile_definitions ($< $< BOOL:${STRICT_APPLE_COMPATIBILITY} > :STRICT_APPLE_COMPATIBILITY> )
152
153
154
+ configure_file (objc/objc-config.h.in objc/objc-config.h @ONLY )
155
+ include_directories ("${PROJECT_BINARY_DIR} /objc/" )
156
+
153
157
if (OLDABI_COMPAT )
154
158
list (APPEND libobjc_C_SRCS legacy.c abi_version.c statics_loader.c )
155
159
add_definitions (-DOLDABI_COMPAT=1 )
Original file line number Diff line number Diff line change @@ -98,14 +98,14 @@ remove_definitions(-D__OBJC_RUNTIME_INTERNAL__=1)
98
98
99
99
add_library (test_runtime_legacy OBJECT Test .m )
100
100
set_target_properties (test_runtime_legacy PROPERTIES
101
- INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} "
101
+ INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} ; ${PROJECT_BINARY_DIR} /objc/ "
102
102
COMPILE_FLAGS "-Xclang -fblocks -fobjc-runtime=gnustep-1.7"
103
103
LINKER_LANGUAGE C
104
104
)
105
105
106
106
add_library (test_runtime OBJECT Test .m )
107
107
set_target_properties (test_runtime PROPERTIES
108
- INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} "
108
+ INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} ; ${PROJECT_BINARY_DIR} /objc/ "
109
109
COMPILE_FLAGS "-Xclang -fblocks -fobjc-runtime=gnustep-2.0"
110
110
LINKER_LANGUAGE C
111
111
)
@@ -123,7 +123,7 @@ function(addtest_flags TEST_NAME FLAGS TEST_SOURCE)
123
123
add_test (${TEST_NAME} ${TEST_NAME} )
124
124
set (ARC "" )
125
125
set_target_properties (${TEST_NAME} PROPERTIES
126
- INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} "
126
+ INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR} ; ${PROJECT_BINARY_DIR} /objc/ "
127
127
COMPILE_FLAGS "-Xclang -fblocks -Xclang -fobjc-exceptions ${FLAGS} "
128
128
LINK_FLAGS ${INCREMENTAL}
129
129
LINKER_LANGUAGE C
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ @interface NoAlloc : Test @end
21
21
@interface NoInit : Test @end
22
22
@interface NoInit2 : NoInit @end
23
23
24
+ @interface ShouldInitSubclassed : NoInit @end
25
+
24
26
@implementation ShouldAlloc
25
27
+ (instancetype )alloc
26
28
{
@@ -91,6 +93,13 @@ + (instancetype)alloc
91
93
}
92
94
@end
93
95
96
+ @implementation ShouldInitSubclassed
97
+ + (instancetype ) alloc
98
+ {
99
+ return [ShouldInit alloc ];
100
+ }
101
+ @end
102
+
94
103
Class getClassNamed (char *name)
95
104
{
96
105
return nil ;
@@ -114,6 +123,10 @@ int main(void)
114
123
[[ShouldInit2 alloc ] init ];
115
124
assert (called);
116
125
126
+ called = NO ;
127
+ [[ShouldInitSubclassed alloc ] init ];
128
+ assert (called);
129
+
117
130
called = NO ;
118
131
[NoAlloc alloc ];
119
132
assert (!called);
Original file line number Diff line number Diff line change @@ -9,9 +9,6 @@ - (id)init;
9
9
@end
10
10
#include < stdio.h>
11
11
12
- /* *
13
- * Equivalent to [cls alloc]. If there's a fast path opt-in, then this skips the message send.
14
- */
15
12
OBJC_PUBLIC
16
13
id
17
14
objc_alloc (Class cls)
@@ -66,6 +63,9 @@ - (id)init;
66
63
return nil ;
67
64
}
68
65
id instance = objc_alloc (cls);
66
+ // If +alloc was overwritten, it is not guaranteed that it returns
67
+ // an instance of cls.
68
+ cls = classForObject (instance);
69
69
if (objc_test_class_flag (cls, objc_class_flag_fast_alloc_init))
70
70
{
71
71
return instance;
Original file line number Diff line number Diff line change
1
+ #cmakedefine STRICT_APPLE_COMPATIBILITY @STRICT_APPLE_COMPATIBILITY@
Original file line number Diff line number Diff line change 2
2
#pragma clang system_header
3
3
#endif
4
4
#include " objc-visibility.h"
5
+ #include " objc-config.h"
5
6
6
7
#ifndef __LIBOBJC_RUNTIME_H_INCLUDED__
7
8
#define __LIBOBJC_RUNTIME_H_INCLUDED__
You can’t perform that action at this time.
0 commit comments