summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/new-array-init.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [c++20] Implement P1009R2: allow omitting the array bound in an arrayRichard Smith2019-05-061-0/+22
| | | | | | | | | | new expression. This was voted into C++20 as a defect report resolution, so we retroactively apply it to all prior language modes (though it can never actually be used before C++11 mode). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360006 91177308-0d34-0410-b5e6-96231b3b80d8
* Change memcpy/memove/memset to have dest and source alignment attributes ↵Daniel Neilson2018-01-191-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | (Step 1). Summary: Upstream LLVM is changing the the prototypes of the @llvm.memcpy/memmove/memset intrinsics. This change updates the Clang tests for this change. The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument which is required to be a constant integer. It represents the alignment of the dest (and source), and so must be the minimum of the actual alignment of the two. This change removes the alignment argument in favour of placing the alignment attribute on the source and destination pointers of the memory intrinsic call. For example, code which used to read: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false) will now read call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false) At this time the source and destination alignments must be the same (Step 1). Step 2 of the change, to be landed shortly, will relax that contraint and allow the source and destination to have different alignments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322964 91177308-0d34-0410-b5e6-96231b3b80d8
* When the new expr's array size is an ICE, emit it as a constant expression.Nick Lewycky2017-02-131-0/+7
| | | | | | | This bypasses integer sanitization checks which are redundant on the expression since it's been checked by Sema. Fixes a clang codegen assertion on "void test() { new int[0+1]{0}; }" when building with -fsanitize=signed-integer-overflow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295006 91177308-0d34-0410-b5e6-96231b3b80d8
* PR22924, PR22845, some of CWG1464: When checking the initializer for an arrayRichard Smith2016-10-051-7/+77
| | | | | | | | | | | | | | | | | | | new expression, distinguish between the case of a constant and non-constant initializer. In the former case, if the bound is erroneous (too many initializer elements, bound is negative, or allocated size overflows), reject, and take the bound into account when determining whether we need to default-construct any elements. In the remanining cases, move the logic to check for default-constructibility of trailing elements into the initialization code rather than inventing a bogus array bound, to cope with cases where the number of initialized elements is not the same as the number of initializer list elements (this can happen due to string literal initialization or brace elision). This also fixes rejects-valid and crash-on-valid errors when initializing a new'd array of character type from a braced string literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283406 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace Sema-level implementation of -fassume-sane-operator-new with aRichard Smith2016-04-071-2/+2
| | | | | | | | | | | | | | | CodeGen-level implementation. Instead of adding an attribute to clang's FunctionDecl, add the IR attribute directly. This means a module built with this flag is now compatible with code built without it and vice versa. This change also results in the 'noalias' attribute no longer being added to calls to operator new in the IR; it's now only added to the declaration. It also fixes a bug where we failed to add the attribute to the 'nothrow' versions (because we didn't implicitly declare them, there was no good time to inject a fake attribute). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265728 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang tests to handle explicitly typed gep changes in LLVM.David Blaikie2015-02-271-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230783 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r216675. This breaks some bots. Before this can be committed ↵Aaron Ballman2014-08-281-6/+1
| | | | | | again, I have to explore runtime ABI requirements with libc++abi. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216677 91177308-0d34-0410-b5e6-96231b3b80d8
* Throw a std::bad_array_new_length exception when the expression (or ↵Aaron Ballman2014-08-281-1/+6
| | | | | | constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216675 91177308-0d34-0410-b5e6-96231b3b80d8
* When emitting a multidimensional array new, emit the initializers for theRichard Smith2014-06-031-2/+17
| | | | | | | | | | trailing elements as a single loop, rather than sometimes emitting a nest of several loops. This fixes a bug where CodeGen would sometimes try to emit an expression with the wrong type for the element being initialized. Plus various other minor cleanups to the IR produced for array new initialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210079 91177308-0d34-0410-b5e6-96231b3b80d8
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-4/+4
| | | | | | tests fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188447 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen for array new list initializers. Doesn't correctly clean up in the ↵Sebastian Redl2012-02-221-0/+33
face of exceptions yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151171 91177308-0d34-0410-b5e6-96231b3b80d8