aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenCXX/new-array-init.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-02-13When the new expr's array size is an ICE, emit it as a constant expression.Nick Lewycky1-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. llvm-svn: 295006
2016-10-05PR22924, PR22845, some of CWG1464: When checking the initializer for an arrayRichard Smith1-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. llvm-svn: 283406
2016-04-07Replace Sema-level implementation of -fassume-sane-operator-new with aRichard Smith1-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). llvm-svn: 265728
2015-02-27Update Clang tests to handle explicitly typed gep changes in LLVM.David Blaikie1-2/+2
llvm-svn: 230783
2014-08-28Reverting r216675. This breaks some bots. Before this can be committed ↵Aaron Ballman1-6/+1
again, I have to explore runtime ABI requirements with libc++abi. llvm-svn: 216677
2014-08-28Throw a std::bad_array_new_length exception when the expression (or ↵Aaron Ballman1-1/+6
constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644. llvm-svn: 216675
2014-06-03When emitting a multidimensional array new, emit the initializers for theRichard Smith1-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. llvm-svn: 210079
2013-08-15CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin1-4/+4
tests fail. llvm-svn: 188447
2012-02-22CodeGen for array new list initializers. Doesn't correctly clean up in the ↵Sebastian Redl1-0/+33
face of exceptions yet. llvm-svn: 151171