summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* [ObjC] Use the name specified by objc_runtime_name instead of the classAkira Hatanaka2018-04-031-2/+6
| | | | | | | | | | | | | identifier. This patch fixes a few places in CGObjCMac.cpp where the class identifier was used instead of the name specified by objc_runtime_name. rdar://problem/37910822 Differential Revision: https://reviews.llvm.org/D45101 llvm-svn: 329128
* Recommit r326946 after reducing CallArgList memory footprintYaxun Liu2018-03-151-2/+2
| | | | llvm-svn: 327634
* Revert r326946. It caused stack overflows by significantly increasing the ↵Richard Smith2018-03-101-2/+2
| | | | | | size of a CallArgList. llvm-svn: 327195
* CodeGen: Fix address space of indirect function argumentYaxun Liu2018-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | 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
* Start setting dllimport/dllexport in setGVProperties.Rafael Espindola2018-03-011-16/+5
| | | | | | | | | | 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
* CodeGen: use `llvm.used` for ObjC protocolsSaleem Abdulrasool2018-01-231-3/+3
| | | | | | | | | These symbols are supposed to be preserved even by the linker. Use the `llvm.used` to ensure that the symbols are not removed by DCE in the linker. This should be a no-op change on MachO since the symbols are annotated as `no_dead_strip`. llvm-svn: 323247
* Remove unused addIfPresent function.Eric Christopher2018-01-131-4/+0
| | | | llvm-svn: 322427
* [driver] Set the 'simulator' environment for Darwin when compiling forAlex Lorenz2017-12-071-4/+1
| | | | | | | | | | iOS/tvOS/watchOS simulator rdar://35135215 Differential Revision: https://reviews.llvm.org/D40682 llvm-svn: 320073
* [CodeGen] Compute the objc EH vtable address point using inbounds GEP.Ahmed Bougacha2017-11-171-2/+3
| | | | | | | | | | | | | | | | The object is provided by the objc runtime and is never visible in the module itself, but even so, the address point we compute points into it, and "+16" is guaranteed not to overflow. This matches the c++ vtable IRGen. Note that I'm not entirely convinced the 'i8*' type is correct here: at the IR level, we're accessing memory that's outside the global object. But we don't control the allocation, so it's not obviously wrong either. But either way, this is only in a global initializer, so I don't think it's going to be mucked with. Filed PR35352 to discuss that. llvm-svn: 318545
* [CodeGen] Add support for IncompleteArrayType in Obj-C ivars.Volodymyr Sapsai2017-10-271-0/+5
| | | | | | | | | | | | | | | | | Fixes an assertion failure when ivar is a struct containing incomplete array. Also completes support for direct flexible array members. rdar://problem/21054495 Reviewers: rjmccall, theraven Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38774 llvm-svn: 316723
* CodeGen: fix a case of incorrect checks for ivarsSaleem Abdulrasool2017-10-251-4/+8
| | | | | | | | Ensure that we check the ivar containing decl for the DLL storage attribute rather than the ivar itself as the dll storage is associated to the interface decl not the ivar decl. llvm-svn: 316545
* Revert "[ADT] Make Twine's copy constructor private."Zachary Turner2017-10-111-35/+40
| | | | | | | | | | This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5. This is failing due to some code that isn't built on MSVC so I didn't catch. Not immediately obvious how to fix this at first glance, so I'm reverting for now. llvm-svn: 315536
* [ADT] Make Twine's copy constructor private.Zachary Turner2017-10-111-40/+35
| | | | | | | | | | | | | | | | | There's a lot of misuse of Twine scattered around LLVM. This ranges in severity from benign (returning a Twine from a function by value that is just a string literal) to pretty sketchy (storing a Twine by value in a class). While there are some uses for copying Twines, most of the very compelling ones are confined to the Twine class implementation itself, and other uses are either dubious or easily worked around. This patch makes Twine's copy constructor private, and fixes up all callsites. Differential Revision: https://reviews.llvm.org/D38767 llvm-svn: 315530
* [objc] Don't require null-check and don't emit memset when result is ignored ↵Kuba Mracek2017-06-301-11/+22
| | | | | | | | | | for struct-returning method calls [clang part] This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer. Differential Revision: https://reviews.llvm.org/D34834 llvm-svn: 306837
* CodeGen: handle missed case of COMDAT handlingSaleem Abdulrasool2017-06-291-6/+5
| | | | | | | | When Protocol references are constructed, we need to add the reference symbol to a COMDAT group on non-MachO object file formats (MachO handles this by having a coalesced attribute). This adds the missing case. llvm-svn: 306622
* CodeGen: make the type match the comment for a libcallSaleem Abdulrasool2017-06-171-1/+1
| | | | | | | | Fix the type for a (runtime) library call to match both the comment and the runtime implementation. As it happens, the type being used matched, this just makes it more precise. llvm-svn: 305638
* CodeGen: fix section names for different file formatsSaleem Abdulrasool2017-06-031-16/+49
| | | | | | | | | This changes the codegen to match the section names according to the ObjC rewriter as well as the runtime. The changes to the test are simply whitespace changes to the section attributes and names and are functionally equivalent (the whitespace is ignored by the linker). llvm-svn: 304661
* Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton2017-05-091-105/+65
| | | | | | | | | | 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
* Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFCSanjoy Das2017-05-011-1/+1
| | | | llvm-svn: 301815
* Revert "Update to LLVM's use of WeakTrackingVH; NFC"Sanjoy Das2017-04-261-1/+1
| | | | | | This reverts commit r301427. llvm-svn: 301430
* Update to LLVM's use of WeakTrackingVH; NFCSanjoy Das2017-04-261-1/+1
| | | | | | | | | | | | Summary: Depends on D32266 Reviewers: davide, dblaikie Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32270 llvm-svn: 301427
* Update Clang for LLVM rename AttributeSet -> AttributeListReid Kleckner2017-03-211-14/+10
| | | | llvm-svn: 298394
* 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
OpenPOWER on IntegriCloud