summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjCXX
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: correct materialize temporary aggregates in ARC modeSaleem Abdulrasool2014-10-241-0/+57
| | | | | | | | | | | | | | | | | | Avoid an assertion when materializing a lifetime type aggregate temporary. When performing CodeGen for ObjC++, we could generate a lifetime-only aggregate temporary by using an initializer list (which is effectively an array). We would reach through the temporary expression, fishing out the inner expression. If this expression was a lifetime expression, we would attempt to emit this as a scalar. This would eventually result in an assertion as the emission would eventually assert that the expression being emitted has a scalar evaluation kind. Add a case to handle the aggregate expressions. Use the EmitAggExpr to emit the aggregate expression rather than the EmitScalarInit. Addresses PR21347. llvm-svn: 220590
* test: add -std=c++11Saleem Abdulrasool2014-10-241-1/+1
| | | | | | | This test uses C++11 features (r-value references) in ObjC++. Add a -std=c++11 to silence a warning. NFC. llvm-svn: 220586
* DebugInfo: Don't leak location information from one function into the ↵David Blaikie2014-10-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | prologue of the next function. CodeGenFunction objects aren't really designed to be reused for more than one function, and doing so can leak debug info location information from one function into the prologue of the next. Add an assertion in to catch reuses of CodeGenFunction, which surprisingly only caught the ObjC atomic getter/setter cases. Fix those and add a test to demonstrate the issue. The test is a bit slim, because we're just testing for the absence of a debug location on the prologue instructions, which by itself probably wouldn't be the end of the world - but the particular debug location that was ending up there was for the previous function's last instruction. This produced debug info for another function within this function, which is something I'm trying to remove all cases of as its a substantial source of bugs, especially around inlining (see r219215). llvm-svn: 219690
* Revert "Remove threshold on object size for inserting lifetime begin / end"Arnaud A. de Grandmaison2014-10-084-57/+2
| | | | | | Revert this patch while I investigate some sanitizer failures off-line. llvm-svn: 219307
* Remove threshold on object size for inserting lifetime begin / endArnaud A. de Grandmaison2014-10-084-2/+57
| | | | | | | | | Boostrapping LLVM+Clang+LLDB without threshold on object size for lifetime markers insertion has shown there was no significant change in compile time, so let the stack slot colorizer do its optimization for all slots. llvm-svn: 219303
* Fix an assertion failure trying to emit a trivial destructor in ObjC++Ben Langmuir2014-09-261-0/+50
| | | | | | | | | | | | | | | | | | If a base class declares a destructor, we will add the implicit destructor for the subclass in ActOnFields -> AddImplicitlyDeclaredMembersToClass But in Objective C++, we did not compute whether we have a trivial destructor until after that in CXXRecordDecl::completeDefinition() This was leading to a mismatch between the class, which thought it had no trivial destructor, and the CXXDestructorDecl, which considered itself trivial. It turns out the reason we delayed setting this until completeDefinition() was for a warning that has since been removed as part of -Warc-abi, so we just do it eagerly now. llvm-svn: 218520
* Objective-C ARC. Use of non-retain/autorelease APIFariborz Jahanian2014-08-082-3/+11
| | | | | | | for building Objective-C array literals in ARC mode. rdar://17554063 llvm-svn: 215232
* Objective-C ARC. More code for Objective-C'sFariborz Jahanian2014-08-061-2/+6
| | | | | | new APIs for literals. nfc. wip. rdar://17554063 llvm-svn: 215043
* CodeGenObjCXX: Add a test for r214699David Majnemer2014-08-051-0/+22
| | | | | | I forgot to add this with the changes for r214699. llvm-svn: 214829
* AST: Fix the mangling for unqualified-blocksDavid Majnemer2014-08-041-7/+6
| | | | | | | | | | | | | | | | CXXNameMangler::mangleUnqualifiedBlock believed that MangleContext::getBlockId returned something that used Itanium-style discriminator numbers. Discriminator numbers start their numberign from 1 and the first mangling that actually gets any sort of number mangled in is the second discriminator. However, Block IDs start from zero. The logic for omitting the mangling number did a ' > 1' instead of a ' > 0' comparison; this could potentially cause mangling conflicts. llvm-svn: 214699
* Mark C++ reference parameters as dereferenceableHal Finkel2014-07-1812-24/+24
| | | | | | | | | | | | | | Because references must be initialized using some evaluated expression, they must point to something, and a callee can assume the reference parameter is dereferenceable. Taking advantage of a new attribute just added to LLVM, mark them as such. Because dereferenceability in addrspace(0) implies nonnull in the backend, we don't need both attributes. However, we need to know the size of the object to use the dereferenceable attribute, so for incomplete types we still emit only nonnull. llvm-svn: 213386
* Improve robustness of tests for module flags metadataOliver Stannard2014-06-191-3/+3
| | | | | | | Fix clang tests to not break if the ID numbers of module flags metadata nodes change. llvm-svn: 211276
* Add 'nonnull' parameter or return attribute when producing an llvm pointer ↵Nick Lewycky2014-05-2812-26/+26
| | | | | | type in a function type where the C++ type is a reference. Update the tests. llvm-svn: 209723
* Include translation unit filename in global ctor symbol names.Nico Weber2014-05-061-1/+1
| | | | | | | | | | | | | | | | | This makes it easier to see where a global ctor comes from, and it also makes ASan's init order analyzer output easier to understand. gcc does this too, but only in -fPIC mode for some reason. Don't do this for constructors with explicit init priority. Also prepend "sub_" before the 'I', that way regular constructors stay lexicographically after symbols with init priority (because ord('s') > ord('I')). gold seems to ignore the name of constructor symbols, and ld only looks at the symbol if it includes an init priority, which this patch doesn't change. Before: __GLOBAL_I_a Now: __GLOBAL_sub_I_myfile.cc llvm-svn: 208128
* Objective-C++ IRGen. Due to change to AST for initialization of c++11’s Fariborz Jahanian2014-03-141-0/+32
| | | | | | | | data members by addition of CXXDefaultInitExpr node to the initializer expression, it has broken treatment of arc code for such initializations. Reviewed by John McCall. // rdar://16299964 llvm-svn: 203935
* Objective-C properties. Fixes a crash in Sema where RHS ofFariborz Jahanian2014-03-061-0/+53
| | | | | | | the property assignment is an lvalue for an incomplete type. // rdar://15118128. Reviewed offline by John McCall. llvm-svn: 203043
* Use private linkage for globals we already name with \01L and \01l.Rafael Espindola2014-02-274-5/+5
| | | | | | | | | | | | In llvm the only semantic difference between internal and private is that llvm tries to hide private globals my mangling them with a private prefix. Since the globals changed by this patch already had the magic don't mangle marker, there should be no change in the generated assembly. A followup patch should then be able to drop the \01L and \01l prefixes and let llvm mangle as appropriate. llvm-svn: 202419
* type_info objects are not unnamed_addr: the ABI requires us toJohn McCall2014-02-081-7/+7
| | | | | | | | | | unique them and permits the implementation of dynamic_cast (and anything else which knows it's working with a complete class type) to compare their addresses directly. rdar://16005328 llvm-svn: 201020
* [ms-cxxabi] Use inalloca on win32 when passing non-trivial C++ objectsReid Kleckner2014-02-011-3/+3
| | | | | | | | | | | | | | | | | | | When a non-trivial parameter is present, clang now gathers up all the parameters that lack inreg and puts them into a packed struct. MSVC always aligns each parameter to 4 bytes and no more, so this is a pretty simple struct to lay out. On win64, non-trivial records are passed indirectly. Prior to this change, clang was incorrectly using byval on win64. I'm able to self-host a working clang with this change and additional LLVM patches. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2636 llvm-svn: 200597
* Remove the -cxx-abi command-line flag.Hans Wennborg2014-01-142-2/+2
| | | | | | | | | | | | | | | This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples, Itanium otherwise. It's no longer possible to do weird combinations. To be able to run a test with a specific ABI without constraining it to a specific triple, new substitutions are added to lit: %itanium_abi_triple and %ms_abi_triple can be used to get the current target triple adjusted to the desired ABI. For example, if the test suite is running with the i686-pc-win32 target, %itanium_abi_triple will expand to i686-pc-mingw32. Differential Revision: http://llvm-reviews.chandlerc.com/D2545 llvm-svn: 199250
* Update tests in preparation for using the MS ABI for Win32 targetsHans Wennborg2014-01-131-1/+1
| | | | | | | | | | In preparation for making the Win32 triple imply MS ABI mode, make all tests pass in this mode, or make them use the Itanium mode explicitly. Differential Revision: http://llvm-reviews.chandlerc.com/D2401 llvm-svn: 199130
* Remove duplicated -cc1 in testsAlp Toker2013-12-081-2/+2
| | | | llvm-svn: 196728
* [ms-cxxabi] Construct and destroy call arguments in the correct orderReid Kleckner2013-12-041-0/+20
| | | | | | | | | | | | | | | | | | | Summary: MSVC destroys arguments in the callee from left to right. Because C++ objects have to be destroyed in the reverse order of construction, Clang has to construct arguments from right to left and destroy arguments from left to right. This patch fixes the ordering by reversing the order of evaluation of all call arguments under the MS C++ ABI. Fixes PR18035. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2275 llvm-svn: 196402
* Fix ObjC @encode for C++ classes w/virtual bases.Eli Friedman2013-09-181-0/+10
| | | | | | PR17142. llvm-svn: 190912
* Don't pass -O0 to clang_cc1, it is the default.Rafael Espindola2013-09-042-2/+2
| | | | llvm-svn: 189910
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-1530-103/+103
| | | | | | tests fail. llvm-svn: 188447
* Compute 'this' correctly for block in lambda.Eli Friedman2013-07-121-0/+18
| | | | | | | | | Using CurFuncDecl is both correct and simple compared to crawling the DeclContexts of the block. Fixes <rdar://problem/14415072>. llvm-svn: 186210
* Finish off mangling locals in block literals.Eli Friedman2013-07-101-4/+1
| | | | | | | Specifically, handle the case where the block is in a default argument in a class method. The mangling here follows what we do for lambdas. llvm-svn: 185991
* More fixes for block mangling.Eli Friedman2013-07-021-7/+7
| | | | | | | | | | | | Make sure we properly treat names defined inside a block as local names. There are basically three fixes here. One, correctly treat blocks as a context where we need to use local-name mangling using the new isLocalContainerContext helper. Two, make CXXNameMangler::manglePrefix handle local names in a consistent way. Three, extend CXXNameMangler::mangleLocalName so it can mangle a block correctly. llvm-svn: 185450
* Fix mangling for block literals.Eli Friedman2013-07-011-6/+32
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* Change mangling of objects inside block literals.Eli Friedman2013-06-241-4/+16
| | | | | | | | | | | | This changes the mangling of local static variables/etc. inside blocks to do something simple and sane. This avoids depending on the way we mangle blocks, which isn't really appropriate here. John, please take a look at this to make sure the mangling I chose is sane. Fixes <rdar://problem/14074423>. llvm-svn: 184780
* Introduce a new mangling for protocol-qualified ObjC types in C++. This allowsEli Friedman2013-06-183-5/+25
| | | | | | | | | | | | to provide proper overloading, and also prevents mangling conflicts with template arguments of protocol-qualified type. This is a non-backward-compatible mangling change, but per discussion with John, the benefits outweigh this cost. Fixes <rdar://problem/14074822>. llvm-svn: 184250
* Add a missing testcase for ObjC ivar encoding for a C++ class with a vptr.Eli Friedman2013-06-171-0/+13
| | | | | | Found by skimming over lcov report. llvm-svn: 184150
* Followup to r183931 to fix the lambda conversion-to-block-pointer member.Eli Friedman2013-06-131-1/+10
| | | | llvm-svn: 183942
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-031-0/+22
| | | | | | | | | | | | | | | | | | a lambda. Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation functions. Fix that by generally improving getNonClosureContext to look through lambdas and captured statements but only report code contexts, which is generally what's wanted. Audit uses of CurFuncDecl and getNonClosureAncestor for correctness. Bug #2 is that lambdas weren't specially mapping 'self' when inside an ObjC method. Fix that by removing the requirement for that and using the normal EmitDeclRefLValue path in LoadObjCSelf. rdar://13800041 llvm-svn: 181000
* Drop ObjCIndirectCopyRestoreExprs during template instantiation.John McCall2013-04-111-0/+22
| | | | | | | | | It's a kind of implicit conversion, which we generally drop, but more importantly it's got very specific placement requirements. rdar://13617051 llvm-svn: 179254
* Don't crash when mangling types defined in ObjC class extensions.John McCall2013-04-101-1/+25
| | | | | | | | | The original test case here was mangling a type name for TBAA, but we can provoke this in C++11 easily enough. rdar://13434937 llvm-svn: 179153
* In ObjC++ on legacy runtimes, push an EH cleanup as well asJohn McCall2013-04-031-0/+80
| | | | | | | | | | | | a normal cleanup when entering a @try or @synchronized to ensure that we clean that up if an exception is triggered. Apparently GCC did this, so it's hard to argue that we shouldn't do at least as much. rdar://12364847 llvm-svn: 178599
* Under ARC, when we're passing the address of a strong variableJohn McCall2013-03-231-0/+2
| | | | | | | | | | | | to an out-parameter using the indirect-writeback conversion, and we copied the current value of the variable to the temporary, make sure that we register an intrinsic use of that value with the optimizer so that the value won't get released until we have a chance to retain it. rdar://13195034 llvm-svn: 177813
* Sema: Preserve attributes on parameters in instantiated function templates.Jordan Rose2013-03-081-0/+48
| | | | | | | | | | | | | | | | | | This was causing correctness issues for ARC and the static analyzer when a function template has "consumed" Objective-C object parameters (i.e. parameters that will be released by the function before returning). The fix is threefold: (1) Actually copy over the attributes from old ParmVarDecls to new ones. (2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes, which it was doing anyway. This allows us to pass an ExtProtoInfo instead of a plain ExtInfo and several flags. (3) Drop param attributes as part of StripImplicitInstantiation, which is used when an implicit instantiation is followed by an explicit one. <rdar://problem/12685622> llvm-svn: 176728
* Correction to r176432: the bug actually fixed was <rdar://13025708>.John McCall2013-03-041-1/+1
| | | | llvm-svn: 176433
* Centralize and refine the __unknown_anytype argument rulesJohn McCall2013-03-041-0/+20
| | | | | | | | | and be sure to apply them whether or not the debugger gave us a method declaration. rdar://12565338 llvm-svn: 176432
* Perform the receiver-expression transformations regardless ofJohn McCall2013-03-011-0/+24
| | | | | | | | | | | | | | whether we already have a method. Fixes a bug where we were failing to properly contextually convert a message receiver during template instantiation. As a side-effect, we now actually perform correct method lookup after adjusting a message-send to integral or non-ObjC pointer types (legal outside of ARC). rdar://13305374 llvm-svn: 176339
* Reapply r176133 with testcase fixes.Bill Wendling2013-02-271-9/+4
| | | | llvm-svn: 176145
* Unify clang/llvm attributes for asan/tsan/msan (Clang part)Kostya Serebryany2013-02-261-2/+2
| | | | | | | | | | | | | | | | | | | These are two related changes (one in llvm, one in clang). LLVM: - rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode) - rename thread_safety => sanitize_thread - rename no_uninitialized_checks -> sanitize_memory CLANG: - add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis)) - add __attribute__((no_sanitize_thread)) - add __attribute__((no_sanitize_memory)) for S in address thread memory If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not set llvm attribute sanitize_S llvm-svn: 176076
* Revert "Add more attributes from the command line to functions."Anna Zaks2013-02-251-4/+9
| | | | | | | | This reverts commit 176009. The commit is a likely cause of several buildbot failures. llvm-svn: 176044
* Add more attributes from the command line to functions.Bill Wendling2013-02-251-9/+4
| | | | | | | This is an ongoing process. Any command line option which a back-end cares about should be added here. llvm-svn: 176009
* Update to use references to attribute groups instead of listing the ↵Bill Wendling2013-02-222-15/+19
| | | | | | attributes on the call/invoke instructions. llvm-svn: 175878
* objective-C arc IR-gen. Retaining of strongFariborz Jahanian2013-02-211-2/+3
| | | | | | | | | | arguments in function prologue is done with objc_StoreStrong to pair it with similar objc_StoreStrong for release in function epilogue. This is done with -O0 only. // rdar://13145317 llvm-svn: 175698
* Attempt to clean up tests for non-X86 platforms.Bill Wendling2013-02-201-6/+6
| | | | llvm-svn: 175652
OpenPOWER on IntegriCloud