mirror of
https://github.com/apple/swift.git
synced 2026-01-13 12:20:10 +01:00
This commit begins to generate correct metadata for @_objcImplementation extensions: • Swift-specific metadata and symbols are not generated. • For main-class @_objcImpls, we visit the class to emit metadata, but visit the extension’s members. • Includes both IR tests and executable tests, including coverage of same-module @objc subclasses, different-module @objc subclasses, and clang subclasses. The test cases do not yet cover stored properties.
31 lines
1.0 KiB
Objective-C
31 lines
1.0 KiB
Objective-C
// This isn't really a test--it's more like an example of how
|
|
// IRGen/objc_implementation.swift would be written in Objective-C to compare
|
|
// the code clang and Swift generate. It's unlikely to ever pass, so it's
|
|
// disabled. If you want to temporarily use it, disable this REQUIRES line:
|
|
// REQUIRES: development_only
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks %S/objc_implementation.swift -import-objc-header %S/Inputs/objc_implementation.h -emit-ir > %t/swift.ll
|
|
// RUN: %clang -S -emit-llvm %target-cc-options -isysroot %clang-importer-sdk-path -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks -I %S/Inputs %s -o %t/clang.ll
|
|
// RUN: ksdiff %t/clang.ll %t/swift.ll
|
|
|
|
#import "objc_implementation.h"
|
|
int printf(const char * restrict format, ...);
|
|
|
|
@implementation ImplClass
|
|
|
|
- (void)mainMethod:(int)value {
|
|
printf("mainMethod");
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation ImplClass (Category1)
|
|
|
|
- (void)category1Method:(int)value {
|
|
printf("category1Method");
|
|
}
|
|
|
|
@end
|
|
|