diff options
author | Joe Daniels <joseph_daniels@apple.com> | 2019-02-04 23:32:55 +0000 |
---|---|---|
committer | Joe Daniels <joseph_daniels@apple.com> | 2019-02-04 23:32:55 +0000 |
commit | f7393d2a3e5ce8766b9eab43d0b68de43f953a5b (patch) | |
tree | f109feeb8dc5c0c93220af790e418d6ae4adfb13 /clang/test/CodeGenObjC/non-lazy-classes.m | |
parent | 3062887c9956f2eeabc2e017fbab5c3ab94710b9 (diff) | |
download | bcm5719-llvm-f7393d2a3e5ce8766b9eab43d0b68de43f953a5b.tar.gz bcm5719-llvm-f7393d2a3e5ce8766b9eab43d0b68de43f953a5b.zip |
[OBJC] Add attribute to mark Objective C class as non-lazy
A non-lazy class will be initialized eagerly when the Objective-C runtime is
loaded. This is required for certain system classes which have instances allocated in
non-standard ways, such as the classes for blocks and constant strings.
Adding this attribute is essentially equivalent to providing a trivial
+load method but avoids the (fairly small) load-time overheads associated
with defining and calling such a method.
Differential Revision: https://reviews.llvm.org/D56555
llvm-svn: 353116
Diffstat (limited to 'clang/test/CodeGenObjC/non-lazy-classes.m')
-rw-r--r-- | clang/test/CodeGenObjC/non-lazy-classes.m | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/CodeGenObjC/non-lazy-classes.m b/clang/test/CodeGenObjC/non-lazy-classes.m index b04b020e20e..aeb2a0dd9cb 100644 --- a/clang/test/CodeGenObjC/non-lazy-classes.m +++ b/clang/test/CodeGenObjC/non-lazy-classes.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-objc-root-class -emit-llvm -o - %s | \ // RUN: FileCheck %s -// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = private global [1 x {{.*}}] {{.*}}@"OBJC_CLASS_$_A"{{.*}}, section "__DATA,__objc_nlclslist,regular,no_dead_strip", align 8 +// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = private global [2 x {{.*}}]{{.*}}@"OBJC_CLASS_$_A"{{.*}},{{.*}}@"OBJC_CLASS_$_D"{{.*}} section "__DATA,__objc_nlclslist,regular,no_dead_strip", align 8 // CHECK: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = private global [1 x {{.*}}] {{.*}}@"\01l_OBJC_$_CATEGORY_A_$_Cat"{{.*}}, section "__DATA,__objc_nlcatlist,regular,no_dead_strip", align 8 @interface A @end @@ -30,3 +30,8 @@ @interface C : A @end @implementation C @end + +__attribute__((objc_nonlazy_class)) +@interface D @end + +@implementation D @end |