summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCGNU.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.David Chisnall2019-03-311-29/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [objc-gnustep] Use .init_array not .ctors when requested.David Chisnall2019-03-311-1/+6
| | | | | | | This doesn't make a difference most of the time but FreeBSD/ARM doesn't run anything in the .ctors array. llvm-svn: 357362
* [opaque pointer types] Cleanup CGBuilder's Create*GEP.James Y Knight2019-02-091-4/+2
| | | | | | | | | | | | | | The various EltSize, Offset, DataLayout, and StructLayout arguments are all computable from the Address's element type and the DataLayout which the CGBuilder already has access to. After having previously asserted that the computed values are the same as those passed in, now remove the redundant arguments from CGBuilder's Create*GEP functions. Differential Revision: https://reviews.llvm.org/D57767 llvm-svn: 353629
* [opaque pointer types] Pass function types for runtime function calls.James Y Knight2019-02-051-53/+50
| | | | | | | | | | | | | Emit{Nounwind,}RuntimeCall{,OrInvoke} have been modified to take a FunctionCallee as an argument, and CreateRuntimeFunction has been modified to return a FunctionCallee. All callers have been updated. Additionally, CreateBuiltinFunction is removed, as it was redundant with CreateRuntimeFunction after some previous changes. Differential Revision: https://reviews.llvm.org/D57668 llvm-svn: 353184
* [objc-gnustep] Fix encoding of ivar size for _Bool.David Chisnall2019-02-031-3/+1
| | | | llvm-svn: 352995
* Cleanup: replace uses of CallSite with CallBase.James Y Knight2019-01-301-14/+13
| | | | llvm-svn: 352595
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [objc-gnustep2] Fix a bug in category generation.David Chisnall2018-12-281-6/+20
| | | | | | | | | 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
* [objc-gnustep] Fix a copy-and-paste error.David Chisnall2018-12-271-1/+1
| | | | | | | We were emitting the null class symbol in the wrong section, which meant that programs that contained no Objective-C classes would fail to link. llvm-svn: 350092
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-261-1/+1
| | | | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 llvm-svn: 343147
* [gnu-objc] Make selector order deterministic.David Chisnall2018-08-141-3/+7
| | | | | | | | | | | | | | | | | | | 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
* Add Windows support for the GNUstep Objective-C ABI V2.David Chisnall2018-08-101-75/+170
| | | | | | | | | | | | | | | | | | | | | Summary: Introduces funclet-based unwinding for Objective-C and fixes an issue where global blocks can't have their isa pointers initialised on Windows. After discussion with Dustin, this changes the name mangling of Objective-C types to prevent a C++ catch statement of type struct X* from catching an Objective-C object of type X*. Reviewers: rjmccall, DHowett-MSFT Reviewed By: rjmccall, DHowett-MSFT Subscribers: mgrang, mstorsjo, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D50144 llvm-svn: 339428
* [CGObjCGNU] Rename GetSelector helper method to fix -Woverloaded-virtual ↵Simon Pilgrim2018-08-081-8/+8
| | | | | | | | | | warning (PR38210) As suggested by @theraven on PR38210, this patch fixes the gcc -Woverloaded-virtual warnings by renaming the extra CGObjCGNU::GetSelector method to CGObjCGNU::GetTypedSelector Differential Revision: https://reviews.llvm.org/D50448 llvm-svn: 339264
* [objc-gnustep] Don't emit .guess ivar offset vars.David Chisnall2018-08-071-34/+4
| | | | | | | | | | | These were intended to allow non-fragile and fragile ABI code to be mixed, as long as the fragile classes were higher up the hierarchy than the non-fragile ones. Unfortunately: - No one actually wants to do this. - Recent versions of Linux's run-time linker break it. llvm-svn: 339128
* Remove trailing spaceFangrui Song2018-07-301-24/+24
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* [objc-gnustep2] Use unsigned char to avoid potential UB in isalnum.David Chisnall2018-05-221-1/+1
| | | | | | Suggested by Gabor Buella. llvm-svn: 332966
* [objc-gnustep2] Use isalnum instead of a less efficient and nonportable ↵David Chisnall2018-05-221-1/+1
| | | | | | | | equivalent. Patch by Hans Wennborg! llvm-svn: 332964
* Revert "Revert r332955 "GNUstep Objective-C ABI version 2""David Chisnall2018-05-221-351/+1399
| | | | llvm-svn: 332963
* Revert r332955 "GNUstep Objective-C ABI version 2"Bjorn Pettersson2018-05-221-1399/+351
| | | | | | | Reverted due to buildbot failures. Seems like isnumber() is some Apple addition to cctype. llvm-svn: 332957
* Add cctype include.David Chisnall2018-05-221-0/+1
| | | | | | | This appears to leak in already on libc++ platforms, but is breaking on some other targets. llvm-svn: 332955
* GNUstep Objective-C ABI version 2David Chisnall2018-05-221-351/+1399
| | | | | | | | | | | | | | | | | | | | | Summary: This includes initial support for the (hopefully final) updated Objective-C ABI, developed here: https://github.com/davidchisnall/clang-gnustep-abi-2 It also includes some cleanups and refactoring from older GNU ABIs. The current version is ELF only, other formats to follow. Reviewers: rjmccall, DHowett-MSFT Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46052 llvm-svn: 332950
* ObjCGNU: Fix empty v3 protocols being emitted two fields shortDavid Chisnall2018-04-121-5/+7
| | | | | | | | | | | | | | | | | | | Summary: Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime. As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid. Reviewers: rjmccall, theraven Reviewed By: rjmccall, theraven Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D45305 llvm-svn: 329882
* Recommit r326946 after reducing CallArgList memory footprintYaxun Liu2018-03-151-1/+1
| | | | llvm-svn: 327634
* Revert r326946. It caused stack overflows by significantly increasing the ↵Richard Smith2018-03-101-1/+1
| | | | | | size of a CallArgList. llvm-svn: 327195
* CodeGen: Fix address space of indirect function argumentYaxun Liu2018-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | The indirect function argument is in alloca address space in LLVM IR. However, during Clang codegen for C++, the address space of indirect function argument should match its address space in the source code, i.e., default addr space, even for indirect argument. This is because destructor of the indirect argument may be called in the caller function, and address of the indirect argument may be taken, in either case the indirect function argument is expected to be in default addr space, not the alloca address space. Therefore, the indirect function argument should be mapped to the temp var casted to default address space. The caller will cast it to alloca addr space when passing it to the callee. In the callee, the argument is also casted to the default address space and used. CallArg is refactored to facilitate this fix. Differential Revision: https://reviews.llvm.org/D34367 llvm-svn: 326946
* Remove redundant casts. NFCGeorge Burgess IV2018-03-011-2/+1
| | | | | | | | | | | | | | | | | | | So I wrote a clang-tidy check to lint out redundant `isa`, `cast`, and `dyn_cast`s for fun. This is a portion of what it found for clang; I plan to do similar cleanups in LLVM and other subprojects when I find time. Because of the volume of changes, I explicitly avoided making any change that wasn't highly local and obviously correct to me (e.g. we still have a number of foo(cast<Bar>(baz)) that I didn't touch, since overloading is a thing and the cast<Bar> did actually change the type -- just up the class hierarchy). I also tried to leave the types we were cast<>ing to somewhere nearby, in cases where it wasn't locally obvious what we were dealing with before. llvm-svn: 326416
* Start setting dllimport/dllexport in setGVProperties.Rafael Espindola2018-03-011-33/+7
| | | | | | | | | | This is the next step in setting dso_local for COFF. The patches changes setGVProperties to first set dllimport/dllexport and changes a few cases that were setting dllimport/dllexport manually. With this a few more GVs are marked dso_local. llvm-svn: 326397
* Fix CGObjCGNU::init bug introduced by r302572Serge Guelton2017-05-091-2/+7
| | | | llvm-svn: 302588
* Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton2017-05-091-70/+57
| | | | | | | | | | Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential revision: https://reviews.llvm.org/D32550 llvm-svn: 302572
* [IR] Abstract away ArgNo+1 attribute indexing as much as possibleReid Kleckner2017-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Do three things to help with that: - Add AttributeList::FirstArgIndex, which is an enumerator currently set to 1. It allows us to change the indexing scheme with fewer changes. - Add addParamAttr/removeParamAttr. This just shortens addAttribute call sites that would otherwise need to spell out FirstArgIndex. - Remove some attribute-specific getters and setters from Function that take attribute list indices. Most of these were only used from BuildLibCalls, and doesNotAlias was only used to test or set if the return value is malloc-like. I'm happy to split the patch, but I think they are probably easier to review when taken together. This patch should be NFC, but it sets the stage to change the indexing scheme to this, which is more convenient when indexing into an array: 0: func attrs 1: retattrs 2...: arg attrs Reviewers: chandlerc, pete, javed.absar Subscribers: david2050, llvm-commits Differential Revision: https://reviews.llvm.org/D32811 llvm-svn: 302060
* [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encodedAkira Hatanaka2017-03-141-1/+1
| | | | | | | | | | correctly. This fixes PR30413. Patch by David Lobron. llvm-svn: 297702
* 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-5/+0
| | | | llvm-svn: 288295
* Prospective MSVC workaround.John McCall2016-11-301-1/+2
| | | | llvm-svn: 288272
* Finish adopting ConstantInitBuilder in CGObjCGNU. NFC.John McCall2016-11-301-180/+180
| | | | llvm-svn: 288269
* getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.John McCall2016-11-291-24/+13
| | | | llvm-svn: 288203
* IRGen: Remove all uses of CreateDefaultAlignedLoad.Peter Collingbourne2016-11-281-3/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D27157 llvm-svn: 288083
* Hide the result of building a constant initializer. NFC.John McCall2016-11-281-15/+15
| | | | llvm-svn: 288080
* ConstantBuilder -> ConstantInitBuilder for clarity, andJohn McCall2016-11-281-19/+19
| | | | | | | move the member classes up to top level to allow forward declarations to name them. NFC. llvm-svn: 288079
* [CodeGen] Pass objects that are expensive to copy by const ref.Benjamin Kramer2016-11-241-5/+5
| | | | | | | No functionality change. Found by clang-tidy's performance-unnecessary-value-param. llvm-svn: 287894
* Introduce a helper class for building complex constant initializers. NFC.John McCall2016-11-191-368/+348
| | | | | | | I've adopted this in most of the places it makes sense, but v-tables and CGObjCMac will need a second pass. llvm-svn: 287437
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-2/+1
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* Refactor call emission to package the function pointer together withJohn McCall2016-10-261-4/+5
| | | | | | | | | | | 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
* Store FileEntry::Filename as a StringRef instead of raw pointer (NFC)Mehdi Amini2016-10-101-1/+1
| | | | llvm-svn: 283815
* CodeGen: honour dllstorage on ObjC typesSaleem Abdulrasool2016-07-171-3/+57
| | | | | | | | 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, formatting cleanups, NFCSaleem Abdulrasool2016-07-171-31/+28
| | | | | | | Format some code which was oddly formatted. Use a bit of auto to make the code more legible. NFC. llvm-svn: 275736
* Use arrays or initializer lists to feed ArrayRefs instead of SmallVector ↵Benjamin Kramer2016-07-021-55/+34
| | | | | | | | where possible. No functionality change intended llvm-svn: 274432
* Restructure the propagation of -fPIC/-fPIE.Rafael Espindola2016-06-231-1/+1
| | | | | | | | | | | | | The PIC and PIE levels are not independent. In fact, if PIE is defined it is always the same as PIC. This is clear in the driver where ParsePICArgs returns a PIC level and a IsPIE boolean. Unfortunately that is currently lost and we pass two redundant levels down the pipeline. This patch keeps a bool and a PIC level all the way down to codegen. llvm-svn: 273566
* Reduce the number of implicit StringRef->std::string conversions by ↵Benjamin Kramer2016-02-131-1/+1
| | | | | | | | threading StringRef through more APIs. No functionality change intended. llvm-svn: 260815
* Fix some Clang-tidy readability-redundant-control-flow warnings; other minor ↵Eugene Zelenko2016-02-101-26/+56
| | | | | | | | fixes. Differential revision: http://reviews.llvm.org/D17060 llvm-svn: 260414
OpenPOWER on IntegriCloud