summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Update for llvm change.Rafael Espindola2015-11-181-1/+1
| | | | llvm-svn: 253440
* Watch and TV OS: wire up basic ABI choicesTim Northover2015-10-301-2/+4
| | | | | | | This sets the mostly expected Darwin default ABI options for these two platforms. Active changes from these defaults for watchOS are in a later patch. llvm-svn: 251708
* Initialize @catch variables correctly in fragile-runtime ARC.John McCall2015-10-301-2/+2
| | | | llvm-svn: 251677
* Fix the emission of ARC ivar layouts in the non-fragile Mac runtime.John McCall2015-10-291-6/+11
| | | | | | | My previous change in this area accidentally broke the rule when InstanceBegin was not a multiple of the word size. llvm-svn: 251666
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-221-18/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
* Enable ARC on the fragile runtime.John McCall2015-10-211-2/+7
| | | | | | | | | | | | | | | | This is almost entirely a matter of just flipping a switch. 99% of the runtime support is available all the way back to when it was implemented in the non-fragile runtime, i.e. in Lion. However, fragile runtimes do not recognize ARC-style ivar layout strings, which means that accessing __strong or __weak ivars reflectively (e.g. via object_setIvar) will end up accessing the ivar as if it were __unsafe_unretained. Therefore, when using reflective technologies like KVC, be sure that your paths always refer to a property. rdar://23209307 llvm-svn: 250955
* Fix and stylize the emission of GC/ARC ivar and GC block layout strings.John McCall2015-10-211-397/+405
| | | | | | | | | | | | | | | Specifically, handle under-aligned object references (by explicitly ignoring them, because this just isn't representable in the format; yes, this means that GC silently ignores such references), descend into anonymous structs and unions, stop classifying fields of pointer-to-strong/weak type as strong/weak in ARC mode, and emit skips to cover the entirety of block layouts in GC mode. As a cleanup, extract this code into a helper class, avoid a number of unnecessary copies and layout queries, generate skips implicitly instead of explicitly tracking them, and clarify the bitmap-creation logic. llvm-svn: 250919
* [CodeGen] Remove dead code. NFC.Benjamin Kramer2015-10-151-3/+0
| | | | llvm-svn: 250418
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-061-2/+1
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* Don't nil check non-nil class receiver of AArch64 stret calls.Ahmed Bougacha2015-10-021-1/+1
| | | | | | | | | | | I randomly came across this difference between AArch64 and other targets: on the latter, we don't emit nil checks for known non-nil class method calls thanks to r247350, but we still do for AArch64 stret calls. They use different code paths, because those are special, as they go through the regular msgSend, not the msgSend*_stret variants. llvm-svn: 249205
* Support noreturn in limited contexts on Objective-C message sends.John McCall2015-09-101-11/+60
| | | | | | rdar://6198039 llvm-svn: 247350
* Compute and preserve alignment more faithfully in IR-generation.John McCall2015-09-081-175/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an Address type to bundle a pointer value with an alignment. Introduce APIs on CGBuilderTy to work with Address values. Change core APIs on CGF/CGM to traffic in Address where appropriate. Require alignments to be non-zero. Update a ton of code to compute and propagate alignment information. As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment helper function to CGF and made use of it in a number of places in the expression emitter. The end result is that we should now be significantly more correct when performing operations on objects that are locally known to be under-aligned. Since alignment is not reliably tracked in the type system, there are inherent limits to this, but at least we are no longer confused by standard operations like derived-to-base conversions and array-to-pointer decay. I've also fixed a large number of bugs where we were applying the complete-object alignment to a pointer instead of the non-virtual alignment, although most of these were hidden by the very conservative approach we took with member alignment. Also, because IRGen now reliably asserts on zero alignments, we should no longer be subject to an absurd but frustrating recurring bug where an incomplete type would report a zero alignment and then we'd naively do a alignmentAtOffset on it and emit code using an alignment equal to the largest power-of-two factor of the offset. We should also now be emitting much more aggressive alignment attributes in the presence of over-alignment. In particular, field access now uses alignmentAtOffset instead of min. Several times in this patch, I had to change the existing code-generation pattern in order to more effectively use the Address APIs. For the most part, this seems to be a strict improvement, like doing pointer arithmetic with GEPs instead of ptrtoint. That said, I've tried very hard to not change semantics, but it is likely that I've failed in a few places, for which I apologize. ABIArgInfo now always carries the assumed alignment of indirect and indirect byval arguments. In order to cut down on what was already a dauntingly large patch, I changed the code to never set align attributes in the IR on non-byval indirect arguments. That is, we still generate code which assumes that indirect arguments have the given alignment, but we don't express this information to the backend except where it's semantically required (i.e. on byvals). This is likely a minor regression for those targets that did provide this information, but it'll be trivial to add it back in a later patch. I partially punted on applying this work to CGBuiltin. Please do not add more uses of the CreateDefaultAligned{Load,Store} APIs; they will be going away eventually. llvm-svn: 246985
* Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed ↵David Blaikie2015-08-181-1/+1
| | | | | | polymorphically llvm-svn: 245378
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* Remove empty non-virtual destructors or mark them =default when non-publicBenjamin Kramer2015-04-111-3/+0
| | | | | | These add no value but can make a class non-trivially copyable. NFC. llvm-svn: 234689
* [opaque pointer type] More GEP API migrationsDavid Blaikie2015-04-051-15/+18
| | | | | | | Looks like the VTable code in particular will need some work to pass around the pointee type explicitly. llvm-svn: 234128
* [opaque pointer type] Explicitly specify type to CreateGEPDavid Blaikie2015-04-031-2/+2
| | | | llvm-svn: 234032
* [opaque pointer type] Update for GEP API changes in LLVMDavid Blaikie2015-04-021-7/+6
| | | | | | | | | | Now the GEP constant utility functions require the type to be explicitly passed (since eventually the pointer type will be opaque and not convey the required type information). For now callers can still pass nullptr (though none were needed here in Clang, which is nice) if convenienc/necessary, but eventually that will be disallowed as well. llvm-svn: 233937
* [Objective-C metadata patch]. Patch to allocate one more space for Fariborz Jahanian2015-03-311-1/+7
| | | | | | Protocol objects in OBJC2. rdar://20286356 llvm-svn: 233766
* Wrap to 80 columns. No behavior change.Nico Weber2015-02-261-3/+4
| | | | llvm-svn: 230682
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-121-20/+16
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* IR: Update clang for Metadata/Value split in r223802Duncan P. N. Exon Smith2014-12-091-5/+4
| | | | | | Match LLVM API changes from r223802. llvm-svn: 223803
* Use nullptr to silence -Wsentinel when self-hosting on WindowsReid Kleckner2014-12-011-29/+29
| | | | | | | | | | | Richard rejected my Sema change to interpret an integer literal zero in a varargs context as a null pointer, so -Wsentinel sees an integer literal zero and fires off a warning. Only CodeGen currently knows that it promotes integer literal zeroes in this context to pointer size on Windows. I didn't want to teach -Wsentinel about that compatibility hack. Therefore, I'm migrating to C++11 nullptr. llvm-svn: 223079
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-1/+1
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
OpenPOWER on IntegriCloud