summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Promote ConstantInitBuilder to be a public CodeGen API; it'sJohn McCall2017-03-021-1/+1
| | | | | | a generally useful utility for other frontends. NFC. llvm-svn: 296806
* Clean up CGObjCMac's APIs for deriving class references. NFC.John McCall2016-11-301-107/+89
| | | | llvm-svn: 288295
* Fix some layering violations where CGObjCMac's NSString emission wasJohn McCall2016-11-301-6/+127
| | | | | | | | | | performed at the CodeGenModule level. Would be NFC except we now also use a different uniquing structure so that we don't get spurious conflicts if you ask for both an NSString and a CFString for the same content (which is possible with builtins). llvm-svn: 288287
* Prospective GCC build fix: the unelaborated form of this friendJohn McCall2016-11-301-2/+2
| | | | | | | declaration should find the right type, assuming it's supported evenly across all our hosts. llvm-svn: 288231
* Switch CGObjCMac to use ConstantInitBuilder. Whew.John McCall2016-11-301-776/+799
| | | | | | | Not strictly NFC because I did change the order of emission of some global constants, but it shouldn't make any difference. llvm-svn: 288229
* getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.John McCall2016-11-291-17/+4
| | | | llvm-svn: 288203
* Refactor call emission to package the function pointer together withJohn McCall2016-10-261-4/+6
| | | | | | | | | | | abstract information about the callee. NFC. The goal here is to make it easier to recognize indirect calls and trigger additional logic in certain cases. That logic will come in a later patch; in the meantime, I felt that this was a significant improvement to the code. llvm-svn: 285258
* CodeGen: be more conservative about setting sectionSaleem Abdulrasool2016-10-251-29/+44
| | | | | | | The section names currently are MachO specific. Only set the section on the variables if the file format is MachO. llvm-svn: 285126
* CodeGen: mark protocols as common dataSaleem Abdulrasool2016-10-251-12/+30
| | | | | | | | This allows for the coalescing of the protocol declarations. When the protocols are declared in headers, multiple definitions of the protocol would be emitted. Marking them as common data indicates that any one can be selected. llvm-svn: 285073
* CodeGen: remove incorrect temporary TwineSaleem Abdulrasool2016-10-241-2/+2
| | | | | | Twines should not be stack allocated. This somehow managed to get past me. llvm-svn: 285028
* CodeGen: centralise label construction for method listsSaleem Abdulrasool2016-10-241-59/+107
| | | | | | | | | | | Move all the label construction for the various method list emission into EmitMethodList. Rather than have all the names be constructed in pieces in all of the callers of EmitMethodList, have this occur in one site. This also makes the calls much easier to understand as we simplify identify the type of the method list being emitted and the interface name for which it is being emitted. NFC. llvm-svn: 285023
* Switch SmallSetVector to use DenseSet when it overflows its inline space.Justin Lebar2016-10-211-3/+4
| | | | | | | | | | | | | | | | | | | | Summary: SetVector already used DenseSet, but SmallSetVector used std::set. This leads to surprising performance differences. Moreover, it means that the set of key types accepted by SetVector and SmallSetVector are quite different! In order to make this change, we had to convert some callsites that used SmallSetVector<std::string, N> to use SmallSetVector<CachedHashString, N> instead. Reviewers: timshen Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25648 llvm-svn: 284887
* CodeGen: further merge cstring literal constructionSaleem Abdulrasool2016-09-201-13/+19
| | | | | | | | Use the new CreateCStringLiteral in an additional site. Now all the C string literals are created in one function. Furthermore, mark the additional literal as an `unnamed_addr constant`. llvm-svn: 281997
* CodeGen: mark ObjC cstring literals as unnamed_addrSaleem Abdulrasool2016-09-181-1/+3
| | | | | | | | These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. llvm-svn: 281855
* CodeGen: mark ObjC cstring literals as constantSaleem Abdulrasool2016-09-181-1/+2
| | | | | | | | These strings are constants, mark them as such. This doesn't matter too much in practice on MachO since the constants are placed into a special section and not referred to directly. llvm-svn: 281854
* CodeGen: refactor the ObjC cstring literal creationSaleem Abdulrasool2016-09-161-44/+57
| | | | | | | | | This refactors the cstring literal creation as mentioned in the couple of FIXMEs littered in the various invocations to CreateMetadataVar. This centralises the definition of the literals, and will enable changing the literal creation to a single site. NFC. llvm-svn: 281798
* CodeGen: use pointer rather than reference in range loopSaleem Abdulrasool2016-09-161-2/+2
| | | | | | | | Address post-commit comments from Justin Bogner. Explicitly indicate that the dereferenced iterator provides a pointer rather than a reference. NFC. llvm-svn: 281730
* CodeGen: use some range-based for loopsSaleem Abdulrasool2016-09-121-14/+10
| | | | | | | Use range-based for loops to simplify the logic. Add an explicit check for MachO as the inline asm uses MachO specific directives. llvm-svn: 281261
* CodeGen: honour dllstorage on ObjC typesSaleem Abdulrasool2016-07-171-34/+114
| | | | | | | | Add support for ObjC types to respect the DLLImport/DLLExport storage annotations. This only effects COFF output. This would allow usage with clang/C2, but not with clang/LLVM due to hard coded section names. llvm-svn: 275737
* CodeGen: whitespace cleanup, StringRef usage in ObjC EH type constructionSaleem Abdulrasool2016-07-171-37/+28
| | | | | | | Clean up some formatting issues and use a bit more StringRef based operations instead of SmallStrings. NFC. llvm-svn: 275735
* CodeGen: use StringRefs more in ObjC class generation, NFCSaleem Abdulrasool2016-07-161-27/+22
| | | | | | | | Rather than building up a number of SmallString-s in order to construct a std::string, use more StringRefs and construct the string once before use. This avoids unnecessary string constructions. NFC. llvm-svn: 275697
* CodeGen: simplify using a local variable, NFCSaleem Abdulrasool2016-07-161-36/+36
| | | | | | | | Add a couple of local variables for the class interface and the super class interface. This allows for the repeated access of the information to be cached and makes the code simpler to understand. NFC. llvm-svn: 275696
* CodeGen: minor cleanup, NFCSaleem Abdulrasool2016-07-131-23/+9
| | | | | | | | Initialise more members in initializer lists. Invert the condition that had grown to be pretty confusing. The `_objc_empty_vtable` is only used on macOS <10.9. This simplifies the code. NFC. llvm-svn: 275241
* Use arrays or initializer lists to feed ArrayRefs instead of SmallVector ↵Benjamin Kramer2016-07-021-12/+10
| | | | | | | | where possible. No functionality change intended llvm-svn: 274432
* Use more ArrayRefsDavid Majnemer2016-06-241-2/+2
| | | | | | No functional change is intended, just a small refactoring. llvm-svn: 273647
* CodeGen: convert some const char * to StringRefSaleem Abdulrasool2016-05-161-33/+21
| | | | | | Convert some use of const char * to StringRef. NFC. llvm-svn: 269630
* ObjC Class Property: don't emit class properties on old deployment targets.Manman Ren2016-04-191-0/+9
| | | | | | | | For old deployment targets, emit nil for all class property lists. rdar://25616128 llvm-svn: 266800
* revert SVN r265702, r265640Saleem Abdulrasool2016-04-081-1/+1
| | | | | | | | | | | Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
* Basic: move CodeGenOptions from FrontendSaleem Abdulrasool2016-04-071-1/+1
| | | | | | | | This is a mechanical move of CodeGenOptions from libFrontend to libBasic. This fixes the layering violation introduced earlier by threading CodeGenOptions into TargetInfo. It should also fix the modules based self-hosting builds. NFC. llvm-svn: 265702
* [Objective-C] Introduce objc_runtime_visible attribute.Douglas Gregor2016-04-011-0/+49
| | | | | | | | | | | | | | | | | | | | The objc_runtime_visible attribute deals with an odd corner case where a particular Objective-C class is known to the Objective-C runtime (and, therefore, accessible by name) but its symbol has been hidden for some reason. For such classes, teach CodeGen to use objc_lookUpClass to retrieve the Class object, rather than referencing the class symbol directly. Classes annotated with objc_runtime_visible have two major limitations that fall out from places where Objective-C metadata needs to refer to the class (or metaclass) symbol directly: * One cannot implement a subclass of an objc_runtime_visible class. * One cannot implement a category on an objc_runtime_visible class. Implements rdar://problem/25494092. llvm-svn: 265201
* Preserve ExtParameterInfos into CGFunctionInfo.John McCall2016-03-111-19/+12
| | | | | | | | | As part of this, make the function-arrangement interfaces a little simpler and more semantic. NFC. llvm-svn: 263191
* Objective-C: Add a size field to non-fragile category metadata.Manman Ren2016-02-241-1/+7
| | | | | | | | | | | This is mainly for extensibility. Note that fragile category metadata, metadata for classes and protocols all have a size field. Initial patch was provided by Greg Parker. rdar://problem/24804226 llvm-svn: 261756
* Class Property: Fix a crash with old ABI when generating metadata in classes.Manman Ren2016-02-211-2/+4
| | | | | | rdar://23891898 llvm-svn: 261466
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-3/+3
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* [Objective-c] Stop attaching section "datacoal_nt" to global variables.Akira Hatanaka2016-02-111-6/+1
| | | | | | | | | | | | | The current macho linker just copies symbols in section datacoal_nt to section data, so it doesn't really matter whether or not section "datacoal_nt" is attached to the global variable. This is a follow-up to r250370, which made changes in llvm to stop putting functions and data in the *coal* sections. rdar://problem/24528611 llvm-svn: 260496
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-101-12/+8
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
* Class Property: generate metadata for class properties in protocols.Manman Ren2016-01-291-5/+16
| | | | | | | | | | The list of class properties is saved in Old ABI: protocol->ext->class_properties (protocol->ext->size will be updated) New ABI: protocol->class_properties (protocol->size will be updated) rdar://23891898 llvm-svn: 259268
* Class Property: generate metadata for class properties in categories.Manman Ren2016-01-291-4/+21
| | | | | | | | | | | The list of class properties is saved in Old ABI: category->class_properties (category->size will be updated as well) New ABI: category->class_properties (a flag in objc_image_info to indicate whether or not the list of class properties is present) rdar://23891898 llvm-svn: 259267
* Class Property: generate metadata for class properties in classes.Manman Ren2016-01-291-28/+57
| | | | | | | | | | The list of class properties is saved in Old ABI: cls->isa->ext->properties New ABI: cls->isa->ro->properties rdar://23891898 llvm-svn: 259229
* Use a consistent spelling for vtables.Eric Christopher2016-01-291-1/+1
| | | | llvm-svn: 259137
* Use instance_properties instead of properties. NFC.Manman Ren2016-01-261-3/+3
| | | | | | | | | | | All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258824
* Update comments to match the implementation.Manman Ren2016-01-251-0/+1
| | | | llvm-svn: 258735
* Update for LLVM function name change.Rui Ueyama2016-01-141-1/+1
| | | | llvm-svn: 257802
* Use std::is_sorted instead of a manual loop. NFCCraig Topper2016-01-031-5/+1
| | | | llvm-svn: 256717
* Reapply "[CodeGen] Fix assignments of inline layouts into the byref structure"Vedant Kumar2015-12-211-0/+2
| | | | | | | | | | | | | | | | | | | When using blocks, a byref structure is created to represent the closure. The "byref.layout" field of this structure is an i8*. However, some 'inline' layouts are represented as i64's, not i8*'s. Prior to r246985 we cast the i64 'inline' layout to an i8* before assigning it into the byref structure. This patch brings the cast back and adds a regression test. The original version of this patch was too invasive. This version only adds the cast to BuildByrefLayout. Differential Revision: http://reviews.llvm.org/D15674 rdar://23713871 llvm-svn: 256190
* Revert "[CodeGen] Fix assignments of inline layouts into the byref structure"Vedant Kumar2015-12-211-2/+1
| | | | | | This reverts commit r256185. It breaks CodeGenObjC/fragile-arc.m. llvm-svn: 256186
* [CodeGen] Fix assignments of inline layouts into the byref structureVedant Kumar2015-12-211-1/+2
| | | | | | | | | | | | | | When using blocks, a byref structure is created to represent the closure. The "byref.layout" field of this structure is an i8*. However, some 'inline' layouts are represented as i64's, not i8*'s. Prior to r246985 we cast the i64 'inline' layout to an i8* before assigning it into the byref structure. This patch brings the cast back and adds a regression test. rdar://23713871 llvm-svn: 256185
* Fix Objective-C metadata for properties from class extensions after r251874Nico Weber2015-12-031-7/+18
| | | | | | | | | | | | After, properties from class extensions no longer show up in ObjCInterfaceDecl::properties(). Make ObjCCommonMac::EmitPropertyList() explicitly look for properties in class extensions before looking at direct properties. Also add a test that passes both with clang before r251874 and after this patch (but fails with r251874 and without this patch). llvm-svn: 254622
* Preserve exceptions information during calls code generation.Samuel Antao2015-11-231-1/+1
| | | | | | | | | | | This patch changes the generation of CGFunctionInfo to contain the FunctionProtoType if it is available. This enables the code generation for call instructions to look into this type for exception information and therefore generate better quality IR - it will not create invoke instructions for functions that are know not to throw. llvm-svn: 253926
* Fix the emission of ARC-style ivar layouts in the fragile runtimeJohn McCall2015-11-191-5/+4
| | | | | | | | | to start at the offset of the first ivar instead of the rounded-up end of the superclass. The latter could include a large amount of tail padding because of a highly-aligned ivar, and subclass ivars can be laid out within that. llvm-svn: 253533
OpenPOWER on IntegriCloud