summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r357452 - 'SimplifyCFG SinkCommonCodeFromPredecessors: Also sink ↵David L. Jones2019-04-041-1/+1
| | | | | | | | | | function calls without used results (PR41259)' This revision causes tests to fail under ASAN. Since the cause of the failures is not clear (could be ASAN, could be a Clang bug, could be a bug in this revision), the safest course of action seems to be to revert while investigating. llvm-svn: 357667
* SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without ↵Hans Wennborg2019-04-021-1/+1
| | | | | | | | | | | | | | | | used results (PR41259) The code was previously checking that candidates for sinking had exactly one use or were a store instruction (which can't have uses). This meant we could sink call instructions only if they had a use. That limitation seemed a bit arbitrary, so this patch changes it to "instruction has zero or one use" which seems more natural and removes the need to special-case stores. Differential revision: https://reviews.llvm.org/D59936 llvm-svn: 357452
* [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.David Chisnall2019-03-311-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Dustin Howett, modified to not change the ABI for ELF platforms. Use more Windows-like section names. This also makes things more readable by PE/COFF debug tools that assume sections fit in the first header. With these changes in, it is now possible to build a working WinObjC with clang and the WinObjC version of GNUstep libobjc (upstream GNUstep libobjc + a work around for incremental linking, which can be removed once LINK.EXE gains a feature to opt sections out of receiving extra padding during an incremental link). Patch by Dustin Howett! Reviewers: DHowett-MSFT Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58724 llvm-svn: 357364
* COMDAT-fold block descriptors.David Chisnall2019-03-311-2/+6
| | | | | | | | | | | Without this change, linking multiple objects containing block descriptors together on Windows will generate duplicate symbol errors. Patch by Dustin Howett! Differential Revision: https://reviews.llvm.org/D58807 llvm-svn: 357363
* [objc-gnustep] Use .init_array not .ctors when requested.David Chisnall2019-03-311-0/+2
| | | | | | | This doesn't make a difference most of the time but FreeBSD/ARM doesn't run anything in the .ctors array. llvm-svn: 357362
* [CodeGen][ObjC] Adjust the addresses passed to calls to synthesizedAkira Hatanaka2019-03-291-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | copy/move constructor/assignment operator functions for non-trivial C structs. This commit fixes a bug where the offset of struct fields weren't being taken into account when computing the addresses passed to calls to the special functions. For example, the copy constructor for S1 (__copy_constructor_8_8_s0_s8) would pass the start addresses of the destination and source structs to the call to S0's copy constructor (_copy_constructor_8_8_s0) without adding the offset of field f1 to the addresses. typedef struct { id f0; S0 f1; } S1; void test(S1 s1) { S1 t = s1; } rdar://problem/49400610 llvm-svn: 357229
* [CodeGen] Add additional mangling for struct members of non trivial structsShoaib Meenai2019-03-282-16/+60
| | | | | | | | | | | | | In https://bugs.llvm.org/show_bug.cgi?id=41206 we observe bad codegen when embedding a non-trivial C struct within a C struct. This is due to the fact that name mangling for non-trivial structs marks the two structs as identical. This diff contains a fix for this issue. Patch by Dan Zimmerman <daniel.zimmerman@me.com>. Differential Revision: https://reviews.llvm.org/D59873 llvm-svn: 357184
* [CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValueAkira Hatanaka2019-03-2112-50/+50
| | | | | | | | | | | | | with notail on x86-64. On x86-64, the epilogue code inserted before the tail jump blocks the autoreleased return optimization. rdar://problem/38675807 Differential Revision: https://reviews.llvm.org/D59656 llvm-svn: 356705
* [CodeGen][ObjC] Remove the leading 'l' from symbols for protocolAkira Hatanaka2019-03-149-19/+34
| | | | | | | | | | | | | metadata and protocol list The leading 'l' tells ld64 to remove the symbol name, which can make debugging difficult. rdar://problem/47256637 Differential Revision: https://reviews.llvm.org/D59234 llvm-svn: 356156
* [ObjC] Emit a boxed expression as a compile-time constant if theAkira Hatanaka2019-03-081-0/+10
| | | | | | | | | | | | | | | | | | expression inside the parentheses is a valid UTF-8 string literal. Previously clang emitted an expression like @("abc") as a message send to stringWithUTF8String. This commit makes clang emit the boxed expression as a compile-time constant instead. This commit also has the effect of silencing the nullable-to-nonnull conversion warning clang started emitting after r317727, which originally motivated this commit (see https://oleb.net/2018/@keypath). rdar://problem/42684601 Differential Revision: https://reviews.llvm.org/D58729 llvm-svn: 355662
* Avoid needlessly copying a block to the heap when a block literalAkira Hatanaka2019-02-272-10/+8
| | | | | | | | | | | | initializes a local auto variable or is assigned to a local auto variable that is declared in the scope that introduced the block literal. rdar://problem/13289333 https://reviews.llvm.org/D58514 llvm-svn: 355012
* [CodeGenObjC] Fix a nullptr dyn_castErik Pilkington2019-02-251-0/+13
| | | | | | | | | | ObjCMessageExpr::getInstanceReceiver returns nullptr if the receiver is 'super'. Make this check more strict, since we don't care about messages to super here. rdar://48247290 llvm-svn: 354826
* Fixed typos in tests: s/CHEKC/CHECK/Dmitri Gribenko2019-02-252-2/+2
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: nemanjai, javed.absar, jsji, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D58611 llvm-svn: 354785
* [CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when availableErik Pilkington2019-02-141-0/+28
| | | | | | | | | | | This provides a code size win on the caller side, since the init message send is done in the runtime function. rdar://44987038 Differential revision: https://reviews.llvm.org/D57936 llvm-svn: 354056
* Fix a few tests that were missing ':' on CHECK lines and weren't testing ↵Nico Weber2019-02-112-2/+2
| | | | | | | | | | | | anything. Found by `git grep '\/\/ CHECK-[^: ]* ' clang/test/ | grep -v RUN:`. Also tweak CodeGenCXX/arm-swiftcall.cpp to still pass now that it checks more. Differential Revision: https://reviews.llvm.org/D58061 llvm-svn: 353744
* [CodeGen][ObjC] Fix assert on calling `__builtin_constant_p` with ObjC objects.Volodymyr Sapsai2019-02-081-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are calling `__builtin_constant_p` with ObjC objects of different classes, we hit the assertion > Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file include/llvm/Support/Casting.h, line 254. It happens because LLVM types for `ObjCInterfaceType` are opaque and have no name (see `CodeGenTypes::ConvertType`). As the result, for different ObjC classes we have different `is_constant` intrinsics with the same name `llvm.is.constant.p0s_s`. When we try to reuse an intrinsic with the same name, we fail because of type mismatch. Fix by bitcasting `ObjCObjectPointerType` to `id` prior to passing as an argument to `__builtin_constant_p`. This results in using intrinsic `llvm.is.constant.p0i8` and correct types. rdar://problem/47499250 Reviewers: rjmccall, ahatanak, void Reviewed By: void, ahatanak Subscribers: ddunbar, jkorous, hans, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D57427 llvm-svn: 353577
* [Sema] Make string literal init an rvalue.Eli Friedman2019-02-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This allows substantially simplifying the expression evaluation code, because we don't have to special-case lvalues which are actually string literal initialization. This currently throws away an optimization where we would avoid creating an array APValue for string literal initialization. If we really want to optimize this case, we should fix APValue so it can store simple arrays more efficiently, like llvm::ConstantDataArray. This shouldn't affect the memory usage for other string literals. (Not sure if this is a blocker; I don't think string literal init is common enough for this to be a serious issue, but I could be wrong.) The change to test/CodeGenObjC/encode-test.m is a weird side-effect of these changes: we currently don't constant-evaluate arrays in C, so the strlen call shouldn't be folded, but lvalue string init managed to get around that check. I this this is fine. Fixes https://bugs.llvm.org/show_bug.cgi?id=40430 . llvm-svn: 353569
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Some of these functions take some extraneous arguments, e.g. EltSize, Offset, which are computable from the Type and DataLayout. Add some asserts to ensure that the computed values are consistent with the passed-in values, in preparation for eliminating the extraneous arguments. This also asserts that the Type is an Array for the calls named "Array" and a Struct for the calls named "Struct". Then, correct a couple of errors: 1. Using CreateStructGEP on an array type. (this causes the majority of the test differences, as struct GEPs are created with i32 indices, while array GEPs are created with i64 indices) 2. Passing the wrong Offset to CreateStructGEP in TargetInfo.cpp on x86-64 NACL (which uses 32-bit pointers). Differential Revision: https://reviews.llvm.org/D57766 llvm-svn: 353529
* [opaque pointer types] Fix the CallInfo passed to EmitCall in someJames Y Knight2019-02-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | edge cases. Currently, EmitCall emits a call instruction with a function type derived from the pointee-type of the callee. This *should* be the same as the type created from the CallInfo parameter, but in some cases an incorrect CallInfo was being passed. All of these fixes were discovered by the addition of the assert in EmitCall which verifies that the passed-in CallInfo matches the Callee's function type. As far as I know, these issues caused no bugs at the moment, as the correct types were ultimately being emitted. But, some would become problematic when pointee types are removed. List of fixes: * arrangeCXXConstructorCall was passing an incorrect value for the number of Required args, when calling an inheriting constructor where the inherited constructor is variadic. (The inheriting constructor doesn't actually get passed any of the user's args, but the code was calculating it as if it did). * arrangeFreeFunctionLikeCall was not including the count of the pass_object_size arguments in the count of required args. * OpenCL uses other address spaces for the "this" pointer. However, commonEmitCXXMemberOrOperatorCall was not annotating the address space on the "this" argument of the call. * Destructor calls were being created with EmitCXXMemberOrOperatorCall instead of EmitCXXDestructorCall in a few places. This was a problem because the calling convention sometimes has destructors returning "this" rather than void, and the latter function knows about that, and sets up the types properly (through calling arrangeCXXStructorDeclaration), while the former does not. * generateObjCGetterBody: the 'objc_getProperty' function returns type 'id', but was being called as if it returned the particular property's type. (That is of course the *dynamic* return type, and there's a downcast immediately after.) * OpenMP user-defined reduction functions (#pragma omp declare reduction) can be called with a subclass of the declared type. In such case, the call was being setup as if the function had been actually declared to take the subtype, rather than the base type. Differential Revision: https://reviews.llvm.org/D57664 llvm-svn: 353181
* [OBJC] Add attribute to mark Objective C class as non-lazyJoe Daniels2019-02-041-1/+6
| | | | | | | | | | | | | 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
* [objc-gnustep] Fix encoding of ivar size for _Bool.David Chisnall2019-02-031-2/+4
| | | | llvm-svn: 352995
* [CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZoneErik Pilkington2019-01-301-8/+21
| | | | | | | | | | | | objc_alloc and objc_allocWithZone may throw exceptions if the underlying method does. If we're in a @try block, then make sure we emit an invoke instead of a call. rdar://47610407 Differential revision: https://reviews.llvm.org/D57476 llvm-svn: 352687
* [clang][slh] add Clang attr no_speculative_load_hardeningZola Bridges2019-01-181-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This attribute will allow users to opt specific functions out of speculative load hardening. This compliments the Clang attribute named speculative_load_hardening. When this attribute or the attribute speculative_load_hardening is used in combination with the flags -mno-speculative-load-hardening or -mspeculative-load-hardening, the function level attribute will override the default during LLVM IR generation. For example, in the case, where the flag opposes the function attribute, the function attribute will take precendence. The sticky inlining behavior of the speculative_load_hardening attribute may cause a function with the no_speculative_load_hardening attribute to be tagged with the speculative_load_hardening tag in subsequent compiler phases which is desired behavior since the speculative_load_hardening LLVM attribute is designed to be maximally conservative. If both attributes are specified for a function, then an error will be thrown. Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54909 llvm-svn: 351565
* [CodeGenObjC] Use a constant value for non-fragile ivar offsets when possibleErik Pilkington2019-01-173-20/+58
| | | | | | | | | | | | | | | If a class inherits from NSObject and has an implementation, then we can assume that ivar offsets won't need to be updated by the runtime. This allows us to index into the object using a constant value and avoid loading from the ivar offset variable. This patch was adapted from one written by Pete Cooper. rdar://problem/10132568 Differential revision: https://reviews.llvm.org/D56802 llvm-svn: 351461
* [ObjCARC] Add an new attribute, objc_externally_retainedErik Pilkington2019-01-041-0/+115
| | | | | | | | | | | | | | | | | | | | This attribute, called "objc_externally_retained", exposes clang's notion of pseudo-__strong variables in ARC. Pseudo-strong variables "borrow" their initializer, meaning that they don't retain/release it, instead assuming that someone else is keeping their value alive. If a function is annotated with this attribute, implicitly strong parameters of that function aren't implicitly retained/released in the function body, and are implicitly const. This is useful to expose for performance reasons, most functions don't need the extra safety of the retain/release, so programmers can opt out as needed. This attribute can also apply to declarations of local variables, with similar effect. Differential revision: https://reviews.llvm.org/D55865 llvm-svn: 350422
* Only convert objc messages to alloc to objc_alloc if the receiver is a class.Pete Cooper2019-01-021-1/+16
| | | | | | | | | | r348687 converted [Foo alloc] to objc_alloc(Foo). However the objc runtime method only takes a Class, not an arbitrary pointer. This makes sure we are messaging a class before we convert these messages. rdar://problem/46943703 llvm-svn: 350224
* [CodeGen] Replace '@' characters in block descriptors' symbol names withAkira Hatanaka2018-12-291-0/+14
| | | | | | | | | | | | | | '\1'. '@' can't be used in block descriptors' symbol names since it is reserved on ELF platforms as a separator between symbol names and symbol versions. See the discussion here: https://reviews.llvm.org/D50783. Differential Revision: https://reviews.llvm.org/D54539 llvm-svn: 350157
* [objc-gnustep2] Fix a bug in category generation.David Chisnall2018-12-281-0/+25
| | | | | | | | | We were not emitting a protocol definition while generating the category method list. This was fine in most cases, because something else in the library typically referenced any given protocol, but it caused linker failures if the category was the only reference to a given protocol. llvm-svn: 350130
* Convert some ObjC retain/release msgSends to runtime calls.Pete Cooper2018-12-211-0/+69
| | | | | | | | | | It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions. Differential Revision: https://reviews.llvm.org/D55869 Reviewed By: rjmccall llvm-svn: 349952
* Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.Pete Cooper2018-12-206-16/+16
| | | | | | | | Calls to this function are deleted in the ARC optimizer. However when the ARC optimizer was updated to use intrinsics instead of functions (r349534), the corresponding clang change (r349535) to use intrinsics missed this one so it wasn't being deleted. llvm-svn: 349782
* Generate objc intrinsics instead of runtime calls as the ARC optimizer now ↵Pete Cooper2018-12-1840-523/+523
| | | | | | | | | works only on intrinsics Differential Revision: https://reviews.llvm.org/D55802 Reviewers: rjmccall llvm-svn: 349535
* Convert some ObjC msgSends to runtime calls.Pete Cooper2018-12-081-0/+80
| | | | | | | | | | | | | | It is faster to directly call the ObjC runtime for methods such as alloc/allocWithZone instead of sending a message to those functions. This patch adds support for converting messages to alloc/allocWithZone to their equivalent runtime calls. Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions. Reviewed By: rjmccall https://reviews.llvm.org/D55349 llvm-svn: 348687
* Ensure sanitizer check function calls have a !dbg locationAdrian Prantl2018-11-281-0/+30
| | | | | | | | | | | | | | | | | | | | | | Function calls without a !dbg location inside a function that has a DISubprogram make it impossible to construct inline information and are rejected by the verifier. This patch ensures that sanitizer check function calls have a !dbg location, by carrying forward the location of the preceding instruction or by inserting an artificial location if necessary. This fixes a crash when compiling the attached testcase with -Os. rdar://problem/45311226 Differential Revision: https://reviews.llvm.org/D53459 Note: This reapllies r344915, modified to reuse the IRBuilder's DebugLoc if one exists instead of picking the one from CGDebugInfo since the latter may get reset when emitting thunks such as block helpers in the middle of emitting another function. llvm-svn: 347810
* [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram ↵Paul Robinson2018-11-285-22/+23
| | | | | | | | flags. Differential Revision: https://reviews.llvm.org/D54756 llvm-svn: 347807
* [CodeGen] Handle extern references to OBJC_CLASS_$_*Erik Pilkington2018-10-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | Some ObjC users declare a extern variable named OBJC_CLASS_$_Foo, then use it's address as a Class. I.e., one could define isInstanceOfF: BOOL isInstanceOfF(id c) { extern void OBJC_CLASS_$_F; return [c class] == (Class)&OBJC_CLASS_$_F; } This leads to asserts in clang CodeGen if there is an @implementation of F in the same TU as an instance of this pattern, because CodeGen assumes that a variable named OBJC_CLASS_$_* has the right type. This commit fixes the problem by RAUWing the old (incorrectly typed) global with a new global, then removing the old global. rdar://45077269 Differential revision: https://reviews.llvm.org/D53154 llvm-svn: 344373
* [CodeGen] Before entering the loop that copies a non-trivial array fieldAkira Hatanaka2018-10-021-0/+31
| | | | | | | | | | | | of a non-trivial C struct, copy the preceding trivial fields that haven't been copied. This commit fixes a bug where the instructions used to copy the preceding trivial fields were emitted inside the loop body. rdar://problem/44185064 llvm-svn: 343556
* Distinguish `__block` variables that are captured by escaping blocksAkira Hatanaka2018-10-014-21/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | from those that aren't. This patch changes the way __block variables that aren't captured by escaping blocks are handled: - Since non-escaping blocks on the stack never get copied to the heap (see https://reviews.llvm.org/D49303), Sema shouldn't error out when the type of a non-escaping __block variable doesn't have an accessible copy constructor. - IRGen doesn't have to use the specialized byref structure (see https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a non-escaping __block variable anymore. Instead IRGen can emit the variable as a normal variable and copy the reference to the block literal. Byref copy/dispose helpers aren't needed either. This reapplies r343518 after fixing a use-after-free bug in function Sema::ActOnBlockStmtExpr where the BlockScopeInfo was dereferenced after it was popped and deleted. rdar://problem/39352313 Differential Revision: https://reviews.llvm.org/D51564 llvm-svn: 343542
* Revert r343518.Akira Hatanaka2018-10-014-82/+21
| | | | | | | | | Bots are still failing. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/24420 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12958 llvm-svn: 343531
* Distinguish `__block` variables that are captured by escaping blocksAkira Hatanaka2018-10-014-21/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from those that aren't. This patch changes the way __block variables that aren't captured by escaping blocks are handled: - Since non-escaping blocks on the stack never get copied to the heap (see https://reviews.llvm.org/D49303), Sema shouldn't error out when the type of a non-escaping __block variable doesn't have an accessible copy constructor. - IRGen doesn't have to use the specialized byref structure (see https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a non-escaping __block variable anymore. Instead IRGen can emit the variable as a normal variable and copy the reference to the block literal. Byref copy/dispose helpers aren't needed either. This reapplies r341754, which was reverted in r341757 because it broke a couple of bots. r341754 was calling markEscapingByrefs after the call to PopFunctionScopeInfo, which caused the popped function scope to be cleared out when the following code was compiled, for example: $ cat test.m struct A { id data[10]; }; void foo() { __block A v; ^{ (void)v; }; } This commit calls markEscapingByrefs before calling PopFunctionScopeInfo to prevent that from happening. rdar://problem/39352313 Differential Revision: https://reviews.llvm.org/D51564 llvm-svn: 343518
* [CodeGen] Revert commit https://reviews.llvm.org/rL342717Calixte Denizet2018-09-242-1/+3
| | | | llvm-svn: 342912
* [CodeGen] Add to emitted DebugLoc information about coverage when it's requiredCalixte Denizet2018-09-212-3/+1
| | | | | | | | | | | | | | | | | | | | Summary: Some lines have a hit counter where they should not have one. Cleanup stuff is located to the last line of the body which is most of the time a '}'. And Exception stuff is added at the beginning of a function and at the end (represented by '{' and '}'). So in such cases, the DebugLoc used in GCOVProfiling.cpp must be marked as not covered. This patch is a followup of https://reviews.llvm.org/D49915. Tests in projects/compiler_rt are fixed by: https://reviews.llvm.org/D49917 Reviewers: marco-c, davidxl Reviewed By: marco-c Subscribers: dblaikie, cfe-commits, sylvestre.ledru Differential Revision: https://reviews.llvm.org/D49916 llvm-svn: 342717
* Remove all uses of DIFlagBlockByrefStructAdrian Prantl2018-09-101-4/+23
| | | | | | | | | | | | This patch removes the last reason why DIFlagBlockByrefStruct from Clang by directly implementing the drilling into the member type done in DwarfDebug::DbgVariable::getType() into the frontend. rdar://problem/31629055 Differential Revision: https://reviews.llvm.org/D51807 llvm-svn: 341842
* Revert r341754.Akira Hatanaka2018-09-094-82/+21
| | | | | | | | | The commit broke a couple of bots: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12347 http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/7310 llvm-svn: 341757
* Distinguish `__block` variables that are captured by escaping blocksAkira Hatanaka2018-09-084-21/+82
| | | | | | | | | | | | | | | | | | | | | | | | from those that aren't. This patch changes the way __block variables that aren't captured by escaping blocks are handled: - Since non-escaping blocks on the stack never get copied to the heap (see https://reviews.llvm.org/D49303), Sema shouldn't error out when the type of a non-escaping __block variable doesn't have an accessible copy constructor. - IRGen doesn't have to use the specialized byref structure (see https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a non-escaping __block variable anymore. Instead IRGen can emit the variable as a normal variable and copy the reference to the block literal. Byref copy/dispose helpers aren't needed either. rdar://problem/39352313 Differential Revision: https://reviews.llvm.org/D51564 llvm-svn: 341754
* [ObjC] Error out when using forward-declared protocol in a @protocolAlex Lorenz2018-08-177-17/+29
| | | | | | | | | | | | | | | | | | | | | | expression Clang emits invalid protocol metadata when a @protocol expression is used with a forward-declared protocol. The protocol metadata is missing protocol conformance list of the protocol since we don't have access to the definition of it in the compiled translation unit. The linker then might end up picking the invalid metadata when linking which will lead to incorrect runtime protocol conformance checks. This commit makes sure that Clang fails to compile code that uses a @protocol expression with a forward-declared protocol. This ensures that Clang does not emit invalid protocol metadata. I added an extra assert in CodeGen to ensure that this kind of issue won't happen in other places. rdar://32787811 Differential Revision: https://reviews.llvm.org/D49462 llvm-svn: 340102
* [CodeGen] Merge identical block descriptor global variables.Akira Hatanaka2018-08-174-13/+13
| | | | | | | | | | | | | | | | | | Currently, clang generates a new block descriptor global variable for each new block literal. This commit merges block descriptors that are identical inside and across translation units using the same approach taken in r339438. To enable merging identical block descriptors, the size and signature of the block and information about the captures are encoded into the name of the block descriptor variable. Also, the block descriptor variable is marked as linkonce_odr and unnamed_addr. rdar://problem/42640703 Differential Revision: https://reviews.llvm.org/D50783 llvm-svn: 340041
* [gnu-objc] Make selector order deterministic.David Chisnall2018-08-141-0/+16
| | | | | | | | | | | | | | | | | | | Summary: This probably fixes PR35277, though there may be other sources of nondeterminism (this was the only case of iterating over a DenseMap). It's difficult to provide a test case for this, because it shows up only on systems with ASLR enabled. Reviewers: rjmccall Reviewed By: rjmccall Subscribers: bmwiedemann, mgrang, cfe-commits Differential Revision: https://reviews.llvm.org/D50559 llvm-svn: 339668
* [CodeGen] Before returning a copy/dispose helper function, bitcast it toAkira Hatanaka2018-08-141-12/+12
| | | | | | | | a void pointer type. This fixes a bug introduced in r339438. llvm-svn: 339633
* Fix check strings in test/CodeGenObjC/arc-blocks.m in preperation forAkira Hatanaka2018-08-141-14/+14
| | | | | | | | fixing a bug introduced in r339438. Check the descriptor global variables in the IR at both -O0 and -O2. llvm-svn: 339632
* Make the section boundary checks on Windows not depend on the order as they ↵Douglas Yung2018-08-111-16/+16
| | | | | | are emitted in reverse when the compiler is built by Visual C++. llvm-svn: 339494
OpenPOWER on IntegriCloud