mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 14:26:06 +00:00
NeXT: Add support for -fobjc-legacy-dispatch.
llvm-svn: 95005
This commit is contained in:
parent
2e3f2c805e
commit
ca5e3eb7f7
@ -21,6 +21,7 @@
|
|||||||
#include "clang/AST/RecordLayout.h"
|
#include "clang/AST/RecordLayout.h"
|
||||||
#include "clang/AST/StmtObjC.h"
|
#include "clang/AST/StmtObjC.h"
|
||||||
#include "clang/Basic/LangOptions.h"
|
#include "clang/Basic/LangOptions.h"
|
||||||
|
#include "clang/CodeGen/CodeGenOptions.h"
|
||||||
|
|
||||||
#include "llvm/Intrinsics.h"
|
#include "llvm/Intrinsics.h"
|
||||||
#include "llvm/LLVMContext.h"
|
#include "llvm/LLVMContext.h"
|
||||||
@ -4224,6 +4225,9 @@ void CGObjCNonFragileABIMac::FinishNonFragileABIModule() {
|
|||||||
/// message dispatch call for all the rest.
|
/// message dispatch call for all the rest.
|
||||||
///
|
///
|
||||||
bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) {
|
bool CGObjCNonFragileABIMac::LegacyDispatchedSelector(Selector Sel) {
|
||||||
|
if (CGM.getCodeGenOpts().ObjCLegacyDispatch)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (NonLegacyDispatchMethods.empty()) {
|
if (NonLegacyDispatchMethods.empty()) {
|
||||||
NonLegacyDispatchMethods.insert(GetNullarySelector("alloc"));
|
NonLegacyDispatchMethods.insert(GetNullarySelector("alloc"));
|
||||||
NonLegacyDispatchMethods.insert(GetNullarySelector("class"));
|
NonLegacyDispatchMethods.insert(GetNullarySelector("class"));
|
||||||
|
26
clang/test/CodeGenObjC/objc2-legacy-dispatch.m
Normal file
26
clang/test/CodeGenObjC/objc2-legacy-dispatch.m
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s
|
||||||
|
//
|
||||||
|
// CHECK_NEW_DISPATCH: define void @f0
|
||||||
|
// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc
|
||||||
|
// CHECK_NEW_DISPATCH: define void @f1
|
||||||
|
// CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
|
||||||
|
//
|
||||||
|
// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s
|
||||||
|
//
|
||||||
|
// CHECK_OLD_DISPATCH: define void @f0
|
||||||
|
// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
|
||||||
|
// CHECK_OLD_DISPATCH: define void @f1
|
||||||
|
// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES
|
||||||
|
|
||||||
|
@interface A
|
||||||
|
+(id) alloc;
|
||||||
|
-(int) im0;
|
||||||
|
@end
|
||||||
|
|
||||||
|
void f0(void) {
|
||||||
|
[A alloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
void f1(A *a) {
|
||||||
|
[a im0];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user