Commit Graph

2319 Commits

Author SHA1 Message Date
Anders Carlsson e828c36933 Add a special BuildVirtualCall that's going to be used for building calls to destructors. This is needed because when compiling:
struct A {
	virtual ~A();
};

void f(A* a) {
	delete a;
}

A's deleting destructor should be called.

llvm-svn: 87083
2009-11-13 04:45:41 +00:00
Anders Carlsson 78cfaa9e56 Fix two bugs with temporaries:
1. For 

A f() {
	return A();
}

we were incorrectly calling the A destructor on the returned object.

2. For

void f(A);
void g() {
	A a;
	f(a);
}

we were incorrectly not calling the copy constructor.

llvm-svn: 87082
2009-11-13 04:34:45 +00:00
Anders Carlsson 87f84c1e72 Move GlobalDecl to its own file. Also add DenseMapInfo traits.
llvm-svn: 87081
2009-11-13 04:25:07 +00:00
Mike Stump fa81808a11 Refine construction vtables; they don't include bits that don't have
virtual bases unless they are morally virtual.

llvm-svn: 87071
2009-11-13 02:35:38 +00:00
Mike Stump 653d0b99df Refine the construction vtables with respect to offsets. WIP.
llvm-svn: 87067
2009-11-13 02:13:54 +00:00
Mike Stump 83066c8dee Allow the tracking of address points for construction vtables as well.
llvm-svn: 87063
2009-11-13 01:54:23 +00:00
Mike Stump 2b34bc5a96 Refine which vtbl is refernced in VTTs.
llvm-svn: 87043
2009-11-12 23:36:21 +00:00
Mike Stump ca0de33113 Refine offsets into vtables for the VTT.
llvm-svn: 87041
2009-11-12 23:14:15 +00:00
Mike Stump 8677bc27bf Refine vtable pointers for secondary vtables inside VTTs to point to
the right base vtable.  WIP.

llvm-svn: 87039
2009-11-12 22:56:32 +00:00
Mike Stump 2cefe38365 Fix the offset calculations for non-virtual bases with overrides.
Refine the VTT entries for virtual bases to refer to the complete
object's vtable instead of constructor vtables.

Refine the AddressPoint calculations for VTT entries for virtual bases.

llvm-svn: 87021
2009-11-12 20:47:57 +00:00
Fariborz Jahanian eb80c98a72 Fix a code gen bug in i386-apple-darwin (objc fragile abi), sending
message to 'super'. Fixes radar 7205866.

llvm-svn: 87017
2009-11-12 20:14:24 +00:00
Devang Patel 94f798c079 "Attach debug info with llvm instructions" mode was enabled a month ago. Now make it permanent and remove old way of inserting intrinsics to encode debug info for locations and types.
llvm-svn: 87007
2009-11-12 18:21:39 +00:00
Devang Patel 6e98d7af22 Use getNameAsCString() instead of getName().data()
llvm-svn: 87001
2009-11-12 17:49:47 +00:00
Chandler Carruth bc55fe26c6 Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
This resolves the layering violation where CodeGen depended on Frontend.

llvm-svn: 86998
2009-11-12 17:24:48 +00:00
Devang Patel 7bdf096f8d Do not use StringRef while using DebugInfo interface.
llvm-svn: 86915
2009-11-12 00:51:46 +00:00
Mike Stump fd84d6d808 Fix ctor vtable name. WIP.
llvm-svn: 86879
2009-11-11 20:32:03 +00:00
Mike Stump eac4559790 Push ctor vtable construction down further. WIP.
llvm-svn: 86878
2009-11-11 20:26:26 +00:00
Devang Patel 5348515193 Do not eagerly set stop point for arguments. This misleads the debugger in identifying beginning of function body. Instead, create new location to attach with llvm.dbg.declare. This location is only used to find the context of the variable by the code generator, and it is not used to emit line number info.
llvm-svn: 86862
2009-11-11 19:10:19 +00:00
Fariborz Jahanian 03f62ed9bb Value initialize non-class array members in ctor's
initializer list. Fixes PR5463.

llvm-svn: 86849
2009-11-11 17:55:25 +00:00
Mike Stump c7b9f5e762 More VTT work. We now track offsets and use the ctor vtable builder
interface.  WIP.

llvm-svn: 86793
2009-11-11 03:08:24 +00:00
Fariborz Jahanian e6c8112572 Avoid generating additional destructor(s) for initialized constructed
objects.

llvm-svn: 86778
2009-11-11 01:13:34 +00:00
Mike Stump 8b2d2d0707 Stub out most of the VTT building code. WIP.
llvm-svn: 86772
2009-11-11 00:35:07 +00:00
Devang Patel af993bf5cc Attach location info with llvm.dbg.declare.
llvm-svn: 86750
2009-11-10 23:07:24 +00:00
Eli Friedman d76f438369 Revert r86741; it doesn't handle virtual bases correctly.
llvm-svn: 86745
2009-11-10 22:48:10 +00:00
Eli Friedman 0960059c0c Minor optimization to skip null check in generated code where it isn't
necessary.

llvm-svn: 86741
2009-11-10 22:42:26 +00:00
Eli Friedman 3ad2645430 Fix for PR5454: make sure to use the right block as the predecessor in the
generated PHI node for the null check of a new operator.

llvm-svn: 86738
2009-11-10 22:39:09 +00:00
Fariborz Jahanian 1254a0978c This patch implements Code gen. for destruction of
global array of objects.

llvm-svn: 86701
2009-11-10 19:24:06 +00:00
Mike Stump b47222144b Only generate a VTT for classes that need a VTT.
llvm-svn: 86699
2009-11-10 19:13:04 +00:00
Mike Stump d846d0825b Add vtable caching to prevent multiple vtables for the same class from
being generated.

Add the most derived vtable pointer to the VTT.

llvm-svn: 86671
2009-11-10 07:44:33 +00:00
Mike Stump 9f23a149cb Be sure to clear out VCall when we clear out VCalls.
Start implementing VTTs.  WIP.

llvm-svn: 86650
2009-11-10 02:30:51 +00:00
Mike Stump 3b9176985d Finish off mangling for the VTT.
llvm-svn: 86647
2009-11-10 01:58:37 +00:00
Mike Stump ef15744092 Add mangling for the construction vtable.
llvm-svn: 86643
2009-11-10 01:41:59 +00:00
Jeffrey Yasskin 612e38026a Fix clang's use of DenseMap iterators after r86636 fixed their constness.
Patch by Victor Zverovich!

llvm-svn: 86638
2009-11-10 01:17:45 +00:00
Mike Stump 68ec7ee0e8 Enable the use of the new llvm objectsize intrinsic.
llvm-svn: 86607
2009-11-09 22:40:09 +00:00
Douglas Gregor 4ef1d400d9 Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.

llvm-svn: 86596
2009-11-09 22:08:55 +00:00
Eli Friedman cc522d9ab3 Rearrange function to avoid recursive use-after-free.
llvm-svn: 86516
2009-11-09 05:07:37 +00:00
Eli Friedman a72bf0fae8 Explicitly note that pre-inc/dec lvalues are not supported yet, so that it
doesn't crash.  (Such expressions are valid in C++, but not in C.)

llvm-svn: 86513
2009-11-09 04:20:47 +00:00
Daniel Dunbar 11c08c8e5b Rename areAllFields32Or64BitBasicType to canExpandIndirectArgument to closer match what it is semantically used for.
Also, fix a major bug where fields from a C++ struct might be dropped -- the expand action doesn't handle them correctly yet.

llvm-svn: 86502
2009-11-09 01:33:53 +00:00
Eli Friedman d7686ef31c Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors.  This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors.  This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.

llvm-svn: 86500
2009-11-09 01:05:47 +00:00
Daniel Dunbar 7e215ea165 Add clarifying parens.
llvm-svn: 86457
2009-11-08 09:46:46 +00:00
Anders Carlsson 5bbdc9f857 Handle member expressions where the member declaration is actually a static variable. Fixes PR5392.
llvm-svn: 86414
2009-11-07 23:16:50 +00:00
Anders Carlsson ea4c30b39a More LValue related code cleanup.
llvm-svn: 86413
2009-11-07 23:06:58 +00:00
Anders Carlsson 2ff6395ddc More cleanup, the code is much easier to follow now.
llvm-svn: 86412
2009-11-07 22:53:10 +00:00
Anders Carlsson 6eee97276b Reduce nesting, no functionality change.
llvm-svn: 86411
2009-11-07 22:46:42 +00:00
Anders Carlsson 03f83e58f7 We only need to call SetObjCNonGC for local variables. No functionality change.
llvm-svn: 86410
2009-11-07 22:43:34 +00:00
Anders Carlsson 509850ebec Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.
llvm-svn: 86407
2009-11-07 22:00:15 +00:00
Chris Lattner 15275e55ce add missing #include
llvm-svn: 86368
2009-11-07 09:22:46 +00:00
Anders Carlsson c0a3561f0f Always mangle functions with special names. Fixes PR5420.
llvm-svn: 86350
2009-11-07 07:15:03 +00:00
Anders Carlsson ce21431fc4 When looking up and adding substitutions to the substitution table, make sure to always use the canonical declaration. With tihs change, FileCheck compiles and links but crashes during startup.
llvm-svn: 86339
2009-11-07 04:26:04 +00:00
Anders Carlsson 3d888e4548 Revert r86315 and add Type::FixedWidthInt to the FIXME cases.
llvm-svn: 86320
2009-11-07 01:19:37 +00:00