| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
implement ARM array cookies. Also fix a few unfortunate bugs:
- throwing dtors in deletes prevented the allocation from being deleted
- adding the cookie to the new[] size was not being considered for
overflow (and, more seriously, was screwing up the earlier checks)
- deleting an array via a pointer to array of class type was not
causing any destructors to be run and was passing the unadjusted
pointer to the deallocator
- lots of address-space problems, in case anyone wants to support
free store in a variant address space :)
llvm-svn: 112814
|
|
|
|
|
|
| |
a c++ class object 'ivar'. Fixes radar 8366604.
llvm-svn: 112729
|
|
|
|
|
|
| |
under the ARM ABI.
llvm-svn: 112588
|
|
|
|
|
|
| |
semantics slightly. No functionality change in the absence of inline namespaces. Also, change a few places where inline namespaces actually make a difference to be prepared for them.
llvm-svn: 112563
|
|
|
|
|
|
| |
multiple dimensions.
llvm-svn: 112188
|
|
|
|
|
|
| |
to the new constants.
llvm-svn: 112047
|
|
|
|
|
|
| |
operator new[].
llvm-svn: 111788
|
|
|
|
|
|
|
|
|
| |
Make CGT defer to the ABI on all member pointer types.
This requires giving CGT a handle to the ABI.
It's way easier to make that work if we avoid lazily creating the ABI.
Make it so.
llvm-svn: 111786
|
|
|
|
|
|
|
|
|
|
|
|
| |
implicitly-defined default constructor, zero-initialize the memory
before calling the default constructor. Previously, we would only
zero-initialize in the case of a trivial default constructor.
Also, simplify the hideous logic that determines when we have a
trivial default constructor and, therefore, don't need to emit any
call at all.
llvm-svn: 111779
|
|
|
|
|
|
|
|
|
|
| |
pointers. I find the resulting code to be substantially cleaner, and it
makes it very easy to use the same APIs for data member pointers (which I have
conscientiously avoided here), and it avoids a plethora of potential
inefficiencies due to excessive memory copying, but we'll have to see if it
actually works.
llvm-svn: 111776
|
|
|
|
| |
llvm-svn: 111771
|
|
|
|
|
|
| |
No functionality change.
llvm-svn: 111752
|
|
|
|
|
|
|
|
| |
update callers as best I can.
- This is a work in progress, our alignment handling is very horrible / sketchy -- I am just aiming for monotonic improvement.
- Serious review appreciated.
llvm-svn: 111707
|
|
|
|
|
|
|
|
| |
trivial default constructors. We're weren't zero-initializing them,
which manifested as <rdar://problem/8320532> (a regression in the GCC
test suite) and is likely to have caused significant other breakage.
llvm-svn: 111650
|
|
|
|
|
|
|
|
|
| |
initializer of (). Make sure to use a simple memset() when we can, or
fall back to generating a loop when a simple memset will not
suffice. Fixes <rdar://problem/8212208>, a regression due to my work
in r107857.
llvm-svn: 108977
|
|
|
|
|
|
| |
doing an overflow check.
llvm-svn: 108943
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which generates more efficient and more obviously conformant
code. We now test for overflow of the multiply then force
the result to -1 if so. On X86, this generates nice code
like this:
__Z4testl: ## @_Z4testl
## BB#0: ## %entry
subl $12, %esp
movl $4, %eax
mull 16(%esp)
testl %edx, %edx
movl $-1, %ecx
cmovel %eax, %ecx
movl %ecx, (%esp)
call __Znam
addl $12, %esp
ret
llvm-svn: 108927
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
causing clang to compile this code into something that correctly throws a
length error, fixing a potential integer overflow security attack:
void *test(long N) {
return new int[N];
}
int main() {
test(1L << 62);
}
We do this even when exceptions are disabled, because it is better for the
code to abort than for the attack to succeed.
This is heavily based on a patch that Fariborz wrote.
llvm-svn: 108915
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
like this:
void *test(long N) {
return new int[N][42][42];
}
the loop generates two dead mul instructions:
%tmp = load i64* %N.addr ; <i64> [#uses=2]
%0 = mul i64 %tmp, 7056 ; <i64> [#uses=1]
%1 = mul i64 %tmp, 42 ; <i64> [#uses=1]
%2 = mul i64 %1, 42 ; <i64> [#uses=0]
%call = call noalias i8* @_Znam(i64 %0) ; <i8*> [#uses=1]
The scale of these multiplies is already handled by the typesize stuff.
llvm-svn: 108884
|
|
|
|
|
|
|
| |
EmitCXXNewAllocSize. This code uses IRBuilder, which does
constant folding already.
llvm-svn: 108882
|
|
|
|
|
|
| |
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
|
|
|
|
|
|
| |
breaking bootstrap on Linux.
llvm-svn: 107837
|
|
|
|
|
|
|
|
|
| |
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.
llvm-svn: 107827
|
|
|
|
|
|
| |
CXXRecordDecl::getDestructor(); no functionality change.
llvm-svn: 107394
|
|
|
|
| |
llvm-svn: 106875
|
|
|
|
|
|
| |
array of other done c++ objects. Fixes PR7490.
llvm-svn: 106869
|
|
|
|
|
|
|
|
| |
objective-c++ class objects which have GC'able objc object
pointers and need to use ObjC's objc_memmove_collectable
API (radar 8070772).
llvm-svn: 106061
|
|
|
|
|
|
| |
in Objective-C++ mode.
llvm-svn: 104281
|
|
|
|
|
|
| |
be turned into a setter call (fixes radar 8008649).
llvm-svn: 104235
|
|
|
|
| |
llvm-svn: 103889
|
|
|
|
|
|
| |
in Objective-c++ mode. Fixes radar 7986354.
llvm-svn: 103887
|
|
|
|
|
|
|
|
|
|
| |
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.
This is just a baby step toward NRVO.
llvm-svn: 103849
|
|
|
|
|
|
|
|
| |
throw, it should use invoke when needed. The fixes the
Boost.Statechrt failures that motivated PR7132, but there are a few
side issues to tackle as well.
llvm-svn: 103803
|
|
|
|
|
|
|
| |
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.
llvm-svn: 103440
|
|
|
|
| |
llvm-svn: 103280
|
|
|
|
|
|
| |
a property of a c++ class object (radar 7957369).
llvm-svn: 103279
|
|
|
|
| |
llvm-svn: 102912
|
|
|
|
| |
llvm-svn: 102882
|
|
|
|
|
|
| |
EmitCXXConstructorCall instead.
llvm-svn: 102881
|
|
|
|
| |
llvm-svn: 102880
|
|
|
|
| |
llvm-svn: 102848
|
|
|
|
| |
llvm-svn: 101666
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.
The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.
This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.
Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.
llvm-svn: 100196
|
|
|
|
|
|
|
|
| |
This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.
llvm-svn: 99920
|
|
|
|
|
|
| |
Fixes PR6641.
llvm-svn: 99404
|
|
|
|
|
|
|
|
|
|
| |
particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
PR6240.
llvm-svn: 95648
|
|
|
|
|
|
|
|
|
|
|
|
| |
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
llvm-svn: 95436
|
|
|
|
|
|
| |
conceptually correct. Review appreciated (Chris, Eli, Anders).
llvm-svn: 95401
|
|
|
|
|
|
| |
call a virtual member function.
llvm-svn: 95307
|
|
|
|
|
|
|
|
| |
realize that CXXConstructExpr is always implicit, so we should just
return its argument (if there is only one) rather than directly
invoking the constructor.
llvm-svn: 95192
|