[OBJC] Add attribute to mark Objective C class as non-lazy
authorJoe Daniels <joseph_daniels@apple.com>
Mon, 4 Feb 2019 23:32:55 +0000 (23:32 +0000)
committerJoe Daniels <joseph_daniels@apple.com>
Mon, 4 Feb 2019 23:32:55 +0000 (23:32 +0000)
commitf7393d2a3e5ce8766b9eab43d0b68de43f953a5b
treef109feeb8dc5c0c93220af790e418d6ae4adfb13
parent3062887c9956f2eeabc2e017fbab5c3ab94710b9
[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
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGenObjC/non-lazy-classes.m
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaObjC/attr-objc-non-lazy.m [new file with mode: 0644]