History log of /external/clang/lib/CodeGen/CGClass.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
/external/clang/lib/CodeGen/CGClass.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
/external/clang/lib/CodeGen/CGClass.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
/external/clang/lib/CodeGen/CGClass.cpp
3cebc73895daccea85984d8881b5b45c8f8df9c6 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y sized deallocation: if we have a use, but not a definition, of a sized
deallocation function (and the corresponding unsized deallocation function has
been declared), emit a weak discardable definition of the function that
forwards to the corresponding unsized deallocation.

This allows a C++ standard library implementation to provide both a sized and
an unsized deallocation function, where the unsized one does not just call the
sized one, for instance by putting both in the same object file within an
archive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8b54999a831bb195c08541ca995ef0505c96193f 30-Oct-2013 Mark Lacey <mark.lacey@apple.com> Add CodeGenABITypes.h for use in LLDB.

CodeGenABITypes is a wrapper built on top of CodeGenModule that exposes
some of the functionality of CodeGenTypes (held by CodeGenModule),
specifically methods that determine the LLVM types appropriate for
function argument and return values.

I addition to CodeGenABITypes.h, CGFunctionInfo.h is introduced, and the
definitions of ABIArgInfo, RequiredArgs, and CGFunctionInfo are moved
into this new header from the private headers ABIInfo.h and CGCall.h.

Exposing this functionality is one part of making it possible for LLDB
to determine the actual ABI locations of function arguments and return
values, making it possible for it to determine this for any supported
target without hard-coding ABI knowledge in the LLDB code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
82552742a1002cf1408d6f371efc9cc6a9f2d7cc 16-Oct-2013 Timur Iskhodzhanov <timurrrr@google.com> [-cxx-abi microsoft] Fix this argument/parameter offsets for virtual destructors in the presence of virtual bases

Reviewed at http://llvm-reviews.chandlerc.com/D1939

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5bd0d44c8da50f3a629c90fee92ce5cf1e31c9ff 09-Oct-2013 Timur Iskhodzhanov <timurrrr@google.com> Initialize vtorDisp in class constructors and destructors

Reviewed at http://llvm-reviews.chandlerc.com/D1867

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192312 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4ee7dc2369c1f0257a73b2e83a7d38fdebdd9176 02-Oct-2013 Nick Lewycky <nicholas@mxc.ca> Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occurs
when scalars are loaded / undergo lvalue-to-rvalue conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d6992ab33b7113e1bd7af51c0c52d17c23706c01 29-Sep-2013 Faisal Vali <faisalv@yahoo.com> Implement conversion to function pointer for generic lambdas without captures.

The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator.

This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM.

A few minor changes:
- per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation).
- I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively.
- Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming.

Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a53d7a0259ff88f78ba8ecac7d0cb3ea96302b1d 27-Sep-2013 Timur Iskhodzhanov <timurrrr@google.com> Abstract out the emission of vtables, add basic support for vtable emission when using -cxx-abi microsoft

Reviewed at http://llvm-reviews.chandlerc.com/D1532

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
62a3bbaac79f6e1b242ae3914e3ed4615f09302d 11-Sep-2013 Nick Lewycky <nicholas@mxc.ca> Disable the bool and enum sanitizers when emitting the implicitly-defined copy
constructor, copy assignment operator and move assignment operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9581ed07dee5376002620a0cfb363c6b9e5bdd3e 26-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> CodeGen: Unify two implementations of canDevirtualizeMemberFunctionCall.

They were mostly copy&paste of each other, move it to CodeGenFunction. Of course
the two implementations have diverged over time; the one in CGExprCXX seems to
be the more modern one so I picked that one and moved it to CGClass which feels
like a better home for it. No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7f918f960101a83163f63bb1e1d42c3f0787887f 21-Aug-2013 Timur Iskhodzhanov <timurrrr@google.com> [CGF] Get rid of passing redundant VTable pointer around in CodeGenFunction::InitializeVTablePointer[s]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8f189a9911a992a5c4118c3789485a85bd96e045 21-Aug-2013 Timur Iskhodzhanov <timurrrr@google.com> Abstract out virtual calls and virtual function prologue code generation; implement them for -cxx-abi microsoft

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a7b879723d3989d85b9492fd8218e7d745367fe3 07-Aug-2013 Jordan Rose <jordan_rose@apple.com> Eliminate CXXConstructorDecl::IsImplicitlyDefined.

This field is just IsDefaulted && !IsDeleted; in all places it's used,
a simple check for isDefaulted() is superior anyway, and we were forgetting
to set it in a few cases.

Also eliminate CXXDestructorDecl::IsImplicitlyDefined, for the same reasons.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a4130baad9d10b7feabb7e003da53424e986d269 22-Jul-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Emit linkonce complete dtors in TUs that need them

Based on Peter Collingbourne's destructor patches.

Prior to this change, clang was considering ?1 to be the complete
destructor and the base destructor, which was wrong. This lead to
crashes when clang tried to emit two LLVM functions with the same name.

In this ABI, TUs with non-inline dtors might not emit a complete
destructor. They are emitted as inline thunks in TUs that need them,
and they always delegate to the base dtors of the complete class and its
virtual bases. This change uses the DeferredDecls machinery to emit
complete dtors as needed.

Currently in clang try body destructors can catch exceptions thrown by
virtual base destructors. In the Microsoft C++ ABI, clang may not have
the destructor definition, in which case clang won't wrap the virtual
virtual base destructor calls in a try-catch. Diagnosing this in user
code is TODO.

Finally, for classes that don't use virtual inheritance, MSVC always
calls the base destructor (?1) directly. This is a useful code size
optimization that avoids emitting lots of extra thunks or aliases.
Implementing it also means our existing tests continue to pass, and is
consistent with MSVC's output.

We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but
it will require further testing.

Reviewers: rjmccall

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1066

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
658cd2c287b1a0b419f51cd18e5a48d4560d1c56 13-Jul-2013 David Blaikie <dblaikie@gmail.com> PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the full definition of a type in -flimit-debug-info

This simplifies the core benefit of -flimit-debug-info by taking a more
systematic approach to avoid emitting debug info definitions for types
that only require declarations. The previous ad-hoc approach (3 cases
removed in this patch) had many holes.

The general approach (adding a bit to TagDecl and callback through
ASTConsumer) has been discussed with Richard Smith - though always open
to revision.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3b50e8d78c34fc57e25781015a2cb0536ca54f89 30-Jun-2013 Stephen Lin <stephenwlin@gmail.com> Restore r184205 and associated commits (after commit of r185290)

This allows clang to use the backend parameter attribute 'returned' when generating 'this'-returning constructors and destructors in ARM and MSVC C++ ABIs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e1e35f761970fd662696b803a839c1f4a56f61b2 28-Jun-2013 Peter Collingbourne <peter@pcc.me.uk> [ms-cxxabi] Move CodeGenVTables::needsVTTParameter to ItaniumCXXABI.

This function only makes sense there. Eventually it should no longer
be part of the CGCXXABI interface, as it is an Itanium-specific detail.

Differential Revision: http://llvm-reviews.chandlerc.com/D821

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3258abc2bad74e8bb1799d124bc4113c7234fa42 20-Jun-2013 Stephen Lin <stephenwlin@gmail.com> Revert r184205 and associated patches while investigating issue with broken buildbot (possible interaction with LTO)

<rdar://problem/14209661>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4444dbbb96ba55ff8a05a1918627f609a387db9f 19-Jun-2013 Stephen Lin <stephenwlin@gmail.com> Corrections to r184205 ('this'-return optimization) due to the wrong version of the patch being committed originally.
1) Removed useless return value of CGCXXABI::EmitConstructorCall and CGCXXABI::EmitVirtualDestructorCall and implementations
2) Corrected last portion of CodeGenCXX/constructor-destructor-return-this to correctly test for non-'this'-return of virtual destructor calls


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9063302a82423cb83f002257a416741850739a70 19-Jun-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Emit and install appropriately mangled vbtables

In Itanium, dynamic classes have one vtable with several different
address points for dynamic base classes that can't share vtables.

In the MS C++ ABI, each vbtable that can't be shared gets its own
symbol, similar to how ctor vtables work in Itanium. However, instead
of mangling the subobject offset into the symbol, the unique portions of
the inheritance path are mangled into the symbol to make it unique.

This patch implements the MSVC 2012 scheme for forming unique vbtable
symbol names. MSVC 2010 use the same mangling with a different subset
of the path. Implementing that mangling and possibly others is TODO.

Each vbtable is an array of i32 offsets from the vbptr that points to it
to another virtual base subobject. The first entry of a vbtable always
points to the base of the current subobject, implying that it is the
same no matter which parent class contains it.

Reviewers: rjmccall

Differential Revision: http://llvm-reviews.chandlerc.com/D636

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d4c0cd07641681de6ed12164aa7a4495ab4b18e5 18-Jun-2013 Stephen Lin <stephenwlin@gmail.com> CodeGen: Have 'this'-returning constructors and destructors to take advantage of the new backend 'returned' attribute.

The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI).

This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b0f533e716ae5a21ca5682ea235a68082fd5ed28 29-May-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Implement MSVC virtual base adjustment

While we can't yet emit vbtables, this allows us to find virtual bases
of objects constructed in other TUs.

This make iostream hello world work, since basic_ostream virtually
inherits from basic_ios.

Differential Revision: http://llvm-reviews.chandlerc.com/D795

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
402cd22c598b39a272f2b31b52b19d4830954e1a 07-May-2013 John McCall <rjmccall@apple.com> Weaken an assertion in memcpyization to account for
unnamed bitfields.

Unnamed bitfields won't have an explicit copy operation
in the AST, which breaks the strong form of the invariant.

rdar://13816940

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f5ebf9bf1df10ac15ba32a4b24dfe171b7848c58 03-May-2013 John McCall <rjmccall@apple.com> Correctly emit certain implicit references to 'self' even within
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
64aa4b3ec7e62288e2e66c1935487ece995ca94b 17-Apr-2013 John McCall <rjmccall@apple.com> Standardize accesses to the TargetInfo in IR-gen.

Patch by Stephen Lin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
63fd408a61ae9b94e8d8a986832f526f7cdbfa84 20-Mar-2013 Manman Ren <mren@apple.com> Exploit this-return of a callsite in a this-return function.

For constructors/desctructors that return 'this', if there exists a callsite
that returns 'this' and is immediately before the return instruction, make
sure we are using the return value from the callsite.

We don't need to keep 'this' alive through the callsite. It also enables
optimizations in the backend, such as tail call optimization.

Updated from r177211.
rdar://12818789


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177541 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7cd84baa533ae337e3eb6b7951d94ce94093d521 16-Mar-2013 Manman Ren <mren@apple.com> revert r177211 due to its potential issues

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177222 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
2710ed8fd997be04ff447b8be2190f8fb34ac22b 16-Mar-2013 Manman Ren <mren@apple.com> Exploit this-return of a callsite in a this-return function.

For constructors/desctructors that return 'this', if there exists a callsite
that returns 'this' and is immediately before the return instruction, make
sure we are using the return value from the callsite.

We don't need to keep 'this' alive through the callsite. It also enables
optimizations in the backend, such as tail call optimization.

rdar://12818789


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177211 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9d232c884ea9872d6555df0fd7359699819bc1f1 07-Mar-2013 John McCall <rjmccall@apple.com> Change hasAggregateLLVMType, which conflates complex and
aggregate types in a profoundly wrong way that has to be
worked around in every call site, to getEvaluationKind,
which classifies and distinguishes between all of these
cases.

Also, normalize the API for loading and storing complexes.

I'm working on a larger patch and wanted to pull these
changes out, but it would have be annoying to detangle
them from each other.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
23742cd8c6416c6c777904fb837b2021361c4f38 05-Mar-2013 Lang Hames <lhames@gmail.com> Use ASTContext::getDeclAlign(<Field Decl>) to get the alignment of the first
field to be memcpy'd, rather instead of ASTContext::getTypeAlign(<Field Type>).
For packed structs the alignment of a field may be less than the alignment of
the field's type.

<rdar://problem/13338585>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1d4fff5551c2347010b955b4337a2aa7d65a050e 27-Feb-2013 Timur Iskhodzhanov <timurrrr@google.com> Better support for constructors with -cxx-abi microsoft, partly fixes PR12784

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5e8577ece79b5ed07b0ab4dcb284a26076efdf65 27-Feb-2013 Lang Hames <lhames@gmail.com> Use the correct alignment for POD-member memcpys where the first field is a
bitfield. CGBitField::StorageAlignment holds the alignment in chars, but
emitMemcpy had been treating it as if it were held in bits, leading to
underaligned memcpys.

Related to PR15348.

Thanks very much to Chandler for the diagnosis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
56c00c4868831c9a137ca7b0e16d063cf986d110 17-Feb-2013 Lang Hames <lhames@gmail.com> Re-apply r174919 - smarter copy/move assignment/construction, with fixes for
bitfield related issues.

The original commit broke Takumi's builder. The bug was caused by bitfield sizes
being determined by their underlying type, rather than the field info. A similar
issue with bitfield alignments showed up on closer testing. Both have been fixed
in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c764830bdb6de82baed068889096bd3e52d4cbda 13-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> ubsan: Add checking for invalid downcasts. Per [expr.static.cast]p2 and p11,
base-to-derived casts have undefined behavior if the object is not actually an
instance of the derived type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
59660c21178b6af518bd4b564e032d5c9cc218cb 13-Feb-2013 Timur Iskhodzhanov <timurrrr@google.com> Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c2808e705eb8a1a825a5807cabc16d55052c31bd 12-Feb-2013 Lang Hames <lhames@gmail.com> Backing out r174919 while I investigate a self-host bug on Takumi's builder.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5310859d0dcec2f3efbeb155ae1cfee14bdd2836 12-Feb-2013 Lang Hames <lhames@gmail.com> When generating IR for default copy-constructors, copy-assignment operators,
move-constructors and move-assignment operators, use memcpy to copy adjacent
POD members.

Previously, classes with one or more Non-POD members would fall back on
element-wise copies for all members, including POD members. This often
generated a lot of IR. Without padding metadata, it wasn't often possible
for the LLVM optimizers to turn the element-wise copies into a memcpy.

This code hasn't yet received any serious tuning. I didn't see any serious
regressions on a self-hosted clang build, or any of the nightly tests, but
I think it's important to get this out in the wild to get more testing.
Insights, feedback and comments welcome.

Many thanks to David Blaikie, Richard Smith, and especially John McCall for
their help and feedback on this work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
074cae0861a87bf96d8ea56d02e34839d9ccbd0a 01-Feb-2013 John McCall <rjmccall@apple.com> Destroy arrays and ARC fields when throwing out of ctors.

Previously we were only handling non-array fields of class type.

Testcases derived from a patch by WenHan Gu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
378e1e739aed97e9b278beeb20e9f5bbe34c0232 31-Jan-2013 Douglas Gregor <dgregor@apple.com> When we're emitting a constructor or destructor call from a delegating
constructor, retrieve our VTT parameter directly. Fixes PR14588 /
<rdar://problem/12867962>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b8b2c9da87e7d70a1679db026f40548b3192b705 25-Jan-2013 John McCall <rjmccall@apple.com> First pass at abstracting out a class for the target C++ ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
cc6456c07a64ba4db7ab972d2519ad985e328289 24-Dec-2012 NAKAMURA Takumi <geek4civic@gmail.com> CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]

/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
72390b39c545426023ec104afe8706395d732bad 20-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename llvm::Attributes to llvm::Attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
ad017fa7a4df7389d245d02a49b3c79ed70bedb9 20-Dec-2012 Bill Wendling <isanbard@gmail.com> Revert r170500. It over-zealously converted *ALL* things named Attributes, which is wrong here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
094dbf917127a1228147587076d59ca45b7c258d 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3bc93e3124ad5e7191c4a12dc981c8ee53578193 19-Dec-2012 David Blaikie <dblaikie@gmail.com> Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365

This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).

Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
50f089a6e1837cb81f8d1830bda6db619e422a2e 14-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Make sure the __invoke function for lambdas returns properly. Per bug report on IRC>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170160 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e9385363069388d8e3536052a138f17332e00620 08-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> When deciding whether to convert an array construction loop into a memcpy, look
at whether the *selected* constructor would be trivial rather than considering
whether the array's element type has *any* non-trivial constructors of the
relevant kind.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7edf9e38b91917b661277601c0e448eef0eb2b56 01-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Simplify: replace getContext().getLangOpts() with just getLangOpts().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4cdad3151bfb2075c6bdbfe89fbb08f31a90a45b 23-Oct-2012 Douglas Gregor <dgregor@apple.com> Switch CodeGenOptions over to a .def file, like we do with LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
fac631052809b59c1b66f687c08a743de7fb50e9 10-Oct-2012 Bill Wendling <isanbard@gmail.com> Have 'addFnAttr' take the attribute enum value. Then have it build the attribute object and add it appropriately. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165596 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4def70d3040e73707c738f7c366737a986135edf 09-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> -fcatch-undefined-behavior: emit calls to the runtime library whenever one of the checks fails.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
859c65cdbe730fd0e940b71ab4ba4884d44a8298 08-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct. PR13154.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161473 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7916c997127fe616ba255ba4cade10e5de0c8812 01-Aug-2012 John McCall <rjmccall@apple.com> When devirtualizing the conversion to a virtual base subobject,
don't explode if the offset we get is zero. This can happen if
you have an empty virtual base class.

While I'm at it, remove an unnecessary block from the IR-generation
of the null-check, mark the eventual GEP as inbounds, and generally
prettify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
0f3d0970dcdf6cf17550b86838dff12813968dbc 07-Jul-2012 John McCall <rjmccall@apple.com> Distinguish more carefully between free functions and C++ instance methods
in the ABI arrangement, and leave a hook behind so that we can easily
tweak CCs on platforms that use different CCs by default for C++
instance methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
581deb3da481053c4993c7600f97acf7768caac5 06-Jun-2012 David Blaikie <dblaikie@gmail.com> Revert Decl's iterators back to pointer value_type rather than reference value_type

In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
262bc18e32500558af7cb0afa205b34bd37bafed 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Remove the ref/value inconsistency in filter_decl_iterator.

filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3a70cd6e1cc414856e41ce5509aa61c89bf472dc 27-Apr-2012 Alexey Samsonov <samsonov@google.com> Use enum to set debug info size generated by Clang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8560791791e7b33249feb0ffafeca427076b37b4 20-Apr-2012 Timur Iskhodzhanov <timurrrr@google.com> Fix bug 12574 - Avoid infinite recursion in constructors and destructors when using Microsoft C++ ABI

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
377ecc7996dce6803f7b7b6208cab5e197c9c5b8 16-Apr-2012 Eli Friedman <eli.friedman@gmail.com> Propagate alignment on lvalues through EmitLValueForField. PR12395.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
56ea377bc58a3a821da917599ed26c6b37b9727c 30-Mar-2012 John McCall <rjmccall@apple.com> Add a note about a missing optimization in the case of virtual
inheritance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
649b4a1a9b5e6f768ca0cb84bd97b00f51083e15 29-Mar-2012 Chad Rosier <mcrosier@apple.com> Revert r153613 as it's causing large compile-time regressions on the nightly testers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
57cd1b89cd91433ce1991a5bff36fe776a263796 29-Mar-2012 John McCall <rjmccall@apple.com> When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value. Fixes PR12204.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8cb4a070d491ddd671b049110cc8d0accb08b905 26-Mar-2012 Kostya Serebryany <kcc@google.com> add tbaa metadata to vtable pointer loads/stores

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
23f0267e2d56c0407f12e62df3561ecf75d74e6e 01-Mar-2012 Eli Friedman <eli.friedman@gmail.com> Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.

Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c5685438df6105052b02c9e02f01c34489606308 28-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Prefer bitcast+GEP over ptrtoint+sub+inttoptr: it's semantically equivalent here, and generally nicer to the optimizer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9a561d539158a30b68fc258b81a994f3fac10212 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure that we delete destructors in the right cases. Specifically:
- variant members with nontrivial destructors make the containing class's
destructor deleted
- check for a virtual destructor after checking for overridden methods in the
base class(es)
- check for an inaccessible operator delete for a class with a virtual
destructor.

Do not try to call an anonymous union field's destructor from the destructor of
the containing class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151483 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
64bee65a3436e3f0c352fcfe2130676f3502cffe 25-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Work-in-progress for lambda conversion-to-block operator. Still need to implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
972edf0534d8a50f87fac1d0ff34eb22f593df11 19-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Make heap-allocation of std::initializer_list 'work'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
924db71fc8f6076c532c8c2ae93acc7f477452c8 19-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Make std::initializer_list member initializers 'work'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
de5d3c717684f3821b8db58037bc7140acf134aa 17-Feb-2012 John McCall <rjmccall@apple.com> Whether an argument is required (in contrast with being an
optional argument passed through the variadic ellipsis)
potentially affects how we need to lower it. Propagate
this information down to the various getFunctionInfo(...)
overloads on CodeGenTypes. Furthermore, rename those
overloads to clarify their distinct purposes, and make
sure we're calling the right one in the right place.
This has a nice side-effect of making it easier to construct
a function type, since the 'variadic' bit is no longer
separable.

This shouldn't really change anything for our existing
platforms, with one minor exception --- we should now call
variadic ObjC methods with the ... in the "right place"
(see the test case), which I guess matters for anyone
running GNUStep on MIPS. Mostly it's just a substantial
clean-up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
27dd7d962bbf774988bc5e59d04a7743ed503514 17-Feb-2012 Douglas Gregor <dgregor@apple.com> Rework the Sema/AST/IRgen dance for the lambda closure type's
conversion to function pointer. Rather than having IRgen synthesize
the body of this function, we instead introduce a static member
function "__invoke" with the same signature as the lambda's
operator() in the AST. Sema then generates a body for the conversion
to function pointer which simply returns the address of __invoke. This
approach makes it easier to evaluate a call to the conversion function
as a constant, makes the linkage of the __invoke function follow the
normal rules for member functions, and may make life easier down the
road if we ever want to constexpr'ify some of lambdas.

Note that IR generation is responsible for filling in the body of
__invoke (Sema just adds a dummy body), because the body can't
generally be expressed in C++.

Eli, please review!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150783 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
21f6ed94b929beea31622f5e6b3890e51293cfad 16-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Initial implementation of IRGen for the lambda conversion-to-function-pointer operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bd89f8c2caa9550e41daa1aa9bf30f0f1e0dfaf7 16-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Start of IRGen for lambda conversion operators.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b74ed087469db042325bad76fdf3ff6ed67dec09 14-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Implement IRGen of lambda expressions which capture arrays.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
0bdb5aa1a3384d194b0e14a9ecbe3309ff33daa3 14-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Refactor out new function EmitInitializerForField from EmitMemberInitializer. The new function will be used to initialize the fields of lambda expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8b418685e9e4f02f4eb2a76e1ec063e07552b68d 07-Feb-2012 Chris Lattner <sabre@nondot.org> simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
af790885c7890f3d205bd4715161289bc8aa3f29 01-Feb-2012 Eric Christopher <echristo@apple.com> Fix comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
516bbd42e62d709013824d6fb8445a0cfda3129a 26-Jan-2012 Peter Collingbourne <peter@pcc.me.uk> Use function pointers, rather than references, to pass Destroyers
around, in the process cleaning up the various gcc/msvc compiler
workarounds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
6da2c716017d5c8530ec99779524491ebc5dadb8 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Switch LValue so that it exposes alignment in CharUnits. (No functional change.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d7722d9d76a851e7897f4127626616d3b1b8e530 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Switch the Alignment argument on AggValueSlot over to CharUnits, per John's review comment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f394078fde147dcf27e9b6a7965517388d64dcb6 03-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Track alignment in AggValueSlot. No functional change in this patch, but I'll be introducing uses of the specified alignment soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145736 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
73fb35003aad027492e661a3749e921b5d1ecaf9 13-Oct-2011 Eric Christopher <echristo@apple.com> Recommit:

Start handling debug line and scope information better:

Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.

Finishes off the rest of rdar://10246360

after fixing a few bugs that were exposed in gdb testsuite testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
28e06354b5d4dd539be6781e388ff27c0dffd807 12-Oct-2011 Eric Christopher <echristo@apple.com> Revert file/scope handling patches. gdb testing revealed a couple of bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141796 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
55acb0d050b303289e552f241a9996df072ca700 12-Oct-2011 Jim Goodnow II <jim@thegoodnows.net> Removed extra line in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4b2d5498729a74a8e952bdf762e6f2d8c6b52690 12-Oct-2011 Eric Christopher <echristo@apple.com> Start handling debug line and scope information better:

Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.

Finishes off the rest of rdar://10246360

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5321bc492b2f29deecb6cb0bc68b7887164ee8a6 29-Sep-2011 Eric Christopher <echristo@apple.com> Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e09cdf46aa2b86c24e6bf7a7ead2eaded964f2ff 26-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Move all vtable layout data into new VTableLayout class

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
84fcc48817bb04c7de1acafcaa1f54ee3235a97b 26-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Move vtable component accessors to VTableContext

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140504 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1d2b31710539d705a3850c9fc3aa1804c2a5efee 26-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Create a VTableContext class and start moving CodeGenVTables methods to it

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
690b2dbde0ef9eec6b5c950b0c4c7106db37f0a5 22-Sep-2011 Douglas Gregor <dgregor@apple.com> Only trigger the initialize-an-array-via-elementwise-copy/move code
generation when we're dealing with an implicitly-defined copy or move
constructor. And, actually set the implicitly-defined bit for
implicitly-defined constructors and destructors. Should fix self-host.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b681fb180dd1d1e8659006f1987711dcc92a6241 22-Sep-2011 Douglas Gregor <dgregor@apple.com> Explicitly-defaulted copy/move constructors are not "implicit", but
they still need the logic to cope with array member
initialization. Fixes PR10720.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
416f63e42d4c34a38833a3aa8fa1ebb3c847722b 18-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
has no effect since any such destructors must be trivial, and in C++11 such destructors must not
be called.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3460c0c761eb4b4b5d835aeda3807f81709df8ef 15-Sep-2011 John McCall <rjmccall@apple.com> Sorry, that assertion actually already exists.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
082aadee6381ec5e99c19c1e4aef41dcc5c00d2b 15-Sep-2011 John McCall <rjmccall@apple.com> We don't generate null initializer expressions anymore, and
we don't need to.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139769 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
85ea7aa961deac1d754f610af8062ae3f8b4e2a5 30-Aug-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Declare and define implicit move constructor and assignment operator.

This makes the code duplication of implicit special member handling even worse,
but the cleanup will have to come later. For now, this works.
Follow-up with tests for explicit defaulting and enabling the __has_feature
flag to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
410ffb2bc5f072d58a73c14560345bcf77dec1cc 26-Aug-2011 John McCall <rjmccall@apple.com> Track whether an AggValueSlot is potentially aliased, and do not
emit call results into potentially aliased slots. This allows us
to properly mark indirect return slots as noalias, at the cost
of requiring an extra memcpy when assigning an aggregate call
result into a l-value. It also brings us into compliance with
the x86-64 ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138599 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7c2349be2d11143a2e59a167fd43362a3bf4585e 25-Aug-2011 John McCall <rjmccall@apple.com> Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c55db3b76df62f2c89e9bcc7437d1065512fb139 09-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Cleanup; no functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
2acc6e3feda5e4f7d9009bdcf8b1cd777fecfe2d 18-Jul-2011 Chris Lattner <sabre@nondot.org> de-constify llvm::Type, patch by David Blaikie!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
dd376cae98ce4d0ab92c90d3e9c01ee19e919f44 13-Jul-2011 John McCall <rjmccall@apple.com> Arrays are permitted to be zero-length in some situations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c3c0766277cd64bf117450a1519c9cf762d994d4 13-Jul-2011 John McCall <rjmccall@apple.com> Convert the standard default-construction loops to use phis and
partial destruction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135033 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8f62992730c88e3b9d6815c322e045e79251d3d5 13-Jul-2011 John McCall <rjmccall@apple.com> Aggressive dead code elimination.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
ad346f4f678ab1c3222425641d851dc63e9dfa1a 12-Jul-2011 John McCall <rjmccall@apple.com> Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags. No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9928c4805aa8d5fabd488d0d0c5aeb64fd50f0e3 12-Jul-2011 John McCall <rjmccall@apple.com> Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bdc4d80956c83a486e58d3df6bb524a1f66ff574 09-Jul-2011 John McCall <rjmccall@apple.com> A number of array-related IR-gen cleanups.
- Emit default-initialization of arrays that were partially initialized
with initializer lists with a loop, rather than emitting the default
initializer N times;
- support destroying VLAs of non-trivial type, although this is not
yet exposed to users; and
- support the partial destruction of arrays initialized with
initializer lists when an initializer throws an exception.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
545d996ec5a3113f046944f11b27cc2d6cb055b4 25-Jun-2011 John McCall <rjmccall@apple.com> LValue carries a type now, so simplify the main EmitLoad/Store APIs
by removing the redundant type parameter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133860 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a07398ed98ea2b55ad7a505a3aab18aed93b149f 16-Jun-2011 John McCall <rjmccall@apple.com> Restore correct use of GC barriers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7a614d8380297fcd2bc23986241905d97222948c 11-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++11 in-class initialization of non-static data members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e3d6cf2149beb1c215ea6e87023c27b4f37712ad 16-May-2011 Anders Carlsson <andersca@mac.com> Fix another regression from the "skip vtable pointer initialization"
optimization. Make sure to require a vtable when trying to get the address
of a VTT, otherwise we would never end up emitting the VTT.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
adf5dc340db3ea99de5fe3f6c42cfee1807d445e 15-May-2011 Anders Carlsson <andersca@mac.com> Re-enable the fix for PR9181 now that all the edge cases are handled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131385 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1493e2369cb426da9d916949f45e62a6e6ac5ab4 15-May-2011 Anders Carlsson <andersca@mac.com> Disable the optimization until the bug noticed by Sean Hunt has been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
ffb945ffb5d29b80fd93649c3572b6d87abce3fc 15-May-2011 Anders Carlsson <andersca@mac.com> When emitting the destructor for a class with a vtable, if we can determine
that the destructor body is trivial and that all member variables also have either
trivial destructors or trivial destructor bodies, we don't need to initialize the
vtable pointers since no virtual member functions will be called on the destructor.

Fixes PR9181.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a2447e0d1e28669cd637204a871f15b1215277fd 08-May-2011 Anders Carlsson <andersca@mac.com> Move code to emit the callee of an CXXOperatorCallExpr out into a separate function in CGClass.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b76af9c969558b4484be87933e89e76e7ee87e21 04-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Ensure that destructors are properly inovked when an exception leaves
the body of a delegating constructor call.

This means that the delegating constructor implementation should be
complete and correct, though there are some rough edges (diagnostic
quality with the cycle detection and using a deleted destructor).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d49bd5515b89bedc57c3d1d3be457e4340dbdb1d 03-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Fix delegating constructors stylistic issues.

Material bugfixes to come this afternoon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
04c9a49ee251424b11d7c4e8b1c23637684cecb6 02-May-2011 Eli Friedman <eli.friedman@gmail.com> Simplify code a bit by using CallArgList::add. No intended functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
059ce0d92eb5a7da900ae735dc0a2ea3d64f4b0b 01-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Fully implement delegating constructors!

As far as I know, this implementation is complete but might be missing a
few optimizations. Exceptions and virtual bases are handled correctly.

Because I'm an optimist, the web page has appropriately been updated. If
I'm wrong, feel free to downgrade its support categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
642a75f883e644bcfbb82e7af0313776ad1ce33c 28-Apr-2011 John McCall <rjmccall@apple.com> When block-capturing a variable with a non-trivial destructor,
make sure to mark the destructor. This normally isn't required,
because the destructor should have been marked as part of the
declaration of the local, but it's necessary when the variable
is a parameter because it's the call sites that are responsible
for those destructors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130372 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b924124316becf2968a37dab36d0c48ea167666f 11-Apr-2011 Anders Carlsson <andersca@mac.com> Replace a couple of Builder.CreateICmpEQ with Builder.CreateIsNull. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
14c65ca4cd914f3090d7eedb9bff4deb0ffc7927 07-Apr-2011 Ken Dyck <kd@kendyck.com> [Reapply r128776, modified so that it does not break debug info.]

Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
62c117db25cf7142e149fce82d2b3caa1237674c 04-Apr-2011 Devang Patel <dpatel@apple.com> Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4fbabd37fd107e0e477b45146499d38a77bf9335 02-Apr-2011 Ken Dyck <kd@kendyck.com> Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bbf3bacb3e0c1ebb3e8a4a8b1330404a7e379315 30-Mar-2011 Jay Foad <jay.foad@gmail.com> Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128538 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4230d529a8797bbeef2328b60abeae333f7e143f 24-Mar-2011 Ken Dyck <kd@kendyck.com> Convert the BaseOffset member of BaseSubobject to CharUnits from bits. No
change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128190 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d6fb21fa1053e5d616af55b181bb03c50d4b0d24 23-Mar-2011 Ken Dyck <kd@kendyck.com> Convert OffsetFromNearestVBast parameter of InitializeVTablePointer(s) to
CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128129 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9a8ad9b28d54a3adc4cb8061d564f99f80144e30 23-Mar-2011 Ken Dyck <kd@kendyck.com> Convert NonVirtual parameter of ApplyNonVirtualAndVirtualOffset() to
CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5fff46b65389f7e7eb576e47c7bc3ca67326a206 22-Mar-2011 Ken Dyck <kd@kendyck.com> Convert Offset variable in GetAddressOfDirectBaseInCompleteClass() to
CharUnits. No change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
55c02585de7b02bcb72352f731d9bc342c8282f3 22-Mar-2011 Ken Dyck <kd@kendyck.com> Change return value of ComputeNonVirtualBaseClassOffset() to CharUnits. No
change in functionality intended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128050 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
413ebdb1af6fb0d81845b61254daf02ba0449afd 11-Mar-2011 John McCall <rjmccall@apple.com> Use a slightly more semantic interface for emitting call arguments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d26bc76c98006609002d9930f8840490e88ac5b5 09-Mar-2011 John McCall <rjmccall@apple.com> Use the "undergoes default argument promotion" bit on parameters to
simplify the logic of initializing function parameters so that we don't need
both a variable declaration and a type in FunctionArgList. This also means
that we need to propagate the CGFunctionInfo down in a lot of places rather
than recalculating it from the FAL. There's more we can do to eliminate
redundancy here, and I've left FIXMEs behind to do it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7a17851eee37f933eb57a5af7e1a0eb455443f6a 28-Feb-2011 Anders Carlsson <andersca@mac.com> Get rid of the areExceptionsEnabled() getter from LangOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3ee36af5bbb8c2cd203a140c3785215539cd56b4 22-Feb-2011 Devang Patel <dpatel@apple.com> A constructor call should force class's debug info even if -flimit-debug-info is enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c1cfdf8647a499b6b3024f4bd14a236cddb23988 20-Feb-2011 Anders Carlsson <andersca@mac.com> Add a LangOptions::areExceptionsEnabled and start using it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d16c2cf1cafa413709aa487cbbd5dc392f1ba1ff 08-Feb-2011 John McCall <rjmccall@apple.com> Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class. Minor other refactorings.

Fixed a few address-space bugs while I was there.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
771c678c04f5f685b4f188ec6c2fd88ad0f7457f 03-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Clean up of -fapple-kext abi code. No change otherwise.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5abec14a235bff4026c030672701a9853350e8cf 03-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> -fapple-kext, elimination of all direct calls to virtual dtors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
ccd5259d33cbbdd6f5fbf7ccab4cb4a2702309ea 02-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> -fapple-kext support for indirect call to virtuals dtors - wip.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1cbce125b91cad81c8be3f8bbae8df917211176c 29-Jan-2011 Anders Carlsson <andersca@mac.com> Make emitting a VTT a two-step process, much like emitting a VTable. You first get the address of the VTT, and then pass it to EmitVTTDefinition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
336a7dc56871ccfeceecc296c9624f66f7ac01ec 29-Jan-2011 Anders Carlsson <andersca@mac.com> When doing a derived-to-base class through a virtual class, we don't have to get the vbase offset from the vtable if the derived class is marked final.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
cbb67480094b3bcb5b715acd827cbad55e2a204c 08-Jan-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
00eb3f9c5b33e3d99aee1f8b75dd9c9678fdd66b 04-Dec-2010 Francois Pichet <pichet2000@gmail.com> More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:

struct X {
X() : au_i1(123) {}
union {
int au_i1;
float au_f1;
};
};

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
34999876e215b22febc240b1a6dc054215d12f9c 13-Nov-2010 Fariborz Jahanian <fjahanian@apple.com> Block API patch to do copy ctor of copied-in cxx objects in
copy helper function and dtor of copied cxx objects
in dispose helper functions. __block variables
TBD next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a14f5979572aa25c03d24750ee4724d2031d4ede 01-Nov-2010 Anders Carlsson <andersca@mac.com> Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
043fb9a1fc0609285f60f0f87e5a18195408f34c 26-Oct-2010 Dan Gohman <gohman@apple.com> Factor out the code for emitting code to load vtable pointer members
so that it's done in one place.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117386 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b6bbcc9995186799a60ce17d0c1acff31601653a 15-Oct-2010 John McCall <rjmccall@apple.com> Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
7e1dff7a68a4d00e71debafa7f5c259473091746 17-Sep-2010 John McCall <rjmccall@apple.com> Currently we're initializing the vtable pointers of a class only after
the bases are completely initialized. This won't work --- base
initializer expressions can rely on the vtables having been set up.
Check for uses of 'this' in the initializers and force a vtable
initialization if found.

This might not be good enough; we might need to extend this to handle
the possibility of arbitrary code finding an external reference to this
(not yet completely-constructed!) object and accessing through it,
in which case we'll probably find ourselves doing a lot more unnecessary
stores.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
558d2abc7f9fd6801cc7677200992313ae90b5d8 15-Sep-2010 John McCall <rjmccall@apple.com> one piece of code is responsible for the lifetime of every aggregate
slot. The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.

I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision. The main obstacle here is that
IR-generation must be much more careful about making sure that exactly



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9f553f5b3bd45304dfda6bdc5cd2baac64b3315b 21-Aug-2010 Daniel Dunbar <daniel@zuster.org> IRgen: Switch a bunch of trivial MakeAddr calls to use MakeAddrLValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d67ef0eed463b43980f04a444155f423114be34b 11-Aug-2010 Devang Patel <dpatel@apple.com> Emit a stop point for delegate constructor call. This gives user a chance to step into constructor body.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f871d0cc377a1367b519a6cce26be74607566eba 07-Aug-2010 John McCall <rjmccall@apple.com> Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths. Avoids a separate allocation and
another word of overhead in cases needing inheritance paths. Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1f0fca54676cfa8616e7f3cd7a26788ab937e3cd 21-Jul-2010 John McCall <rjmccall@apple.com> Rename LazyCleanup -> Cleanup. No functionality change for these last three
commits.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
81407d404a3fc8d24d0e2a052d85cae183033e2b 21-Jul-2010 John McCall <rjmccall@apple.com> Switch the destructor for a temporary arising from a reference binding over to
using a lazy cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
50da2cadcc6da86abff6772de65280ace2cabc94 21-Jul-2010 John McCall <rjmccall@apple.com> Implement proper base/member destructor EH chaining.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
291ae949612e371c41bf771a483b407d49372a4f 21-Jul-2010 John McCall <rjmccall@apple.com> Change PushDestructorCleanup to use lazy cleanups.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
182ab5112650d3228291c4dadd64a9f77f5aeb51 21-Jul-2010 John McCall <rjmccall@apple.com> Convert the EH cleanups for base and member destructors in a constructor into
lazy cleanups.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
59174c0633fb5cde41735cfbff5744bdf837e8d9 21-Jul-2010 Douglas Gregor <dgregor@apple.com> Implement zero-initialization for array new when there is an
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
da65ea86482bc116906edfb9ba1d7124f76cc867 13-Jul-2010 John McCall <rjmccall@apple.com> Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.

Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this; for now we have some awkward code
duplication.

Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
59a7000a79118e4c140885ccbb2ac6a686a73092 07-Jul-2010 John McCall <rjmccall@apple.com> Teach function-try-blocks on constructors and destructors to implicitly
rethrow. Fixes rdar://problem/7696603



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f1549f66a8216a78112286e3978cea2c29d6334c 06-Jul-2010 John McCall <rjmccall@apple.com> Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host. Hopefully these results hold up on different platforms.

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions. Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former. Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work. Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however. The HH is an unfortunate requirement of LLVM's EH IR.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107631 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1d110e05e0ff48c1c7a483d6b7fd094cdf28316a 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Remove unnecessary ASTContext parameter from
CXXRecordDecl::getDestructor(); no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
32f36baa6c8d491c374af622b4e3ac28d597453c 26-Jun-2010 Anders Carlsson <andersca@mac.com> Change EmitReferenceBindingToExpr to take a decl instead of a boolean.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
772913659894551b02f342e3577e7219e4f9a701 09-Jun-2010 Anders Carlsson <andersca@mac.com> Move GenerateCXXAggrDestructorHelper to CGDeclCXX.cpp where it belongs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
02e370a02f05b4a734fe5e8c88efc4ed9dac60fa 09-Jun-2010 Anders Carlsson <andersca@mac.com> Simplify GenerateCXXAggrDestructorHelper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105646 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
0b29227012aacb1ae42277b0a63d28acb1b35270 03-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Don't intentionally try to ignore the value of a scalar expression when we
actually care about it. Fixes PR7291.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105404 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
2736071ea3a46f90e65c93418961611d96c10ab9 27-May-2010 John McCall <rjmccall@apple.com> Correctly pass aggregates by reference when emitting thunks.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104778 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1884eb0b5c55edda4893ddec45e7dbad79758782 22-May-2010 Anders Carlsson <andersca@mac.com> Re-land the fix for PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
892fa6c5e152dd22e4ba460d5c8cd5c79d657e87 22-May-2010 Anders Carlsson <andersca@mac.com> Unbreak self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
db9b12e32c988e4a6ac49404fd2513d0b05bba32 21-May-2010 Anders Carlsson <andersca@mac.com> Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104387 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a9976d3b192690db20f59dc44099ac4ca939bdb7 21-May-2010 John McCall <rjmccall@apple.com> When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous
records.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
985f73960ac76842da4b10c30ca87a282ff9aa31 06-May-2010 Chris Lattner <sabre@nondot.org> simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,
fixing PR7063.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103171 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
fb8cc253420e93cee33d29df5a2bdae6aaf16e39 05-May-2010 Douglas Gregor <dgregor@apple.com> Reimplement code generation for copying fields in the
implicitly-generated copy constructor. Previously, Sema would perform
some checking and instantiation to determine which copy constructors,
etc., would be called, then CodeGen would attempt to figure out which
copy constructor to call... but would get it wrong, or poke at an
uninstantiated default argument, or fail in other ways.

The new scheme is similar to what we now do for the implicit
copy-assignment operator, where Sema performs all of the semantic
analysis and builds specific ASTs that look similar to the ASTs we'd
get from explicitly writing the copy constructor, so that CodeGen need
only do a direct translation.

However, it's not quite that simple because one cannot explicit write
elementwise copy-construction of an array. So, I've extended
CXXBaseOrMemberInitializer to contain a list of indexing variables
used to copy-construct the elements. For example, if we have:

struct A { A(const A&); };

struct B {
A array[2][3];
};

then we generate an implicit copy assignment operator for B that looks
something like this:

B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { }

CodeGen will loop over the invented variables i0 and i1 to visit all
elements in the array, so that each element in the destination array
will be copy-constructed from the corresponding element in the source
array. Of course, if we're dealing with arrays of scalars or class
types with trivial copy-assignment operators, we just generate a
memcpy rather than a loop.

Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes
all of its regression tests.

Conspicuously missing from this patch is handling for the exceptional
case, where we need to destruct those objects that we have
constructed. I'll address that case separately.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3d6c1782c4fc2ed3e6a924c15042edb1f56fee36 04-May-2010 John McCall <rjmccall@apple.com> When inheriting a default argument expression, inherit the full expression,
not just the inner expression. This is important if the expression has any
temporaries. Fixes PR 7028.

Basically a symptom of really tragic method names.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
43373963ac204ff491ec8851e706eb7423f951ce 03-May-2010 Anders Carlsson <andersca@mac.com> Remove OldGetAddressOfBaseClass - bye bye ambiguities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102889 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8246cc7f85a9b307900e9c05e7e1bb8a40b2b7a5 03-May-2010 Anders Carlsson <andersca@mac.com> Get rid of the last caller of OldGetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4235840554aaed11efd479df9e622dc82ab77e6d 03-May-2010 Anders Carlsson <andersca@mac.com> More work towards getting rid of OldGetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102887 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
77fae58f6dedd85c2506100e1754a2233a9c5e3a 03-May-2010 Anders Carlsson <andersca@mac.com> Get rid of a call to GetAddressOfDirectBaseInCompleteClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c11bb2191088b9e74bec5007a4e05c78b41a8f64 03-May-2010 Anders Carlsson <andersca@mac.com> Have getSubVTTIndex take a BaseSubobject instead of just a base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
314e622d20e67ad2f9bd3e3d4473fb23bec93132 03-May-2010 Anders Carlsson <andersca@mac.com> Pass ForVirtualBase all the way to GetVTTParameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8e6404ca28d6bbb76e97ea2a53a74816c2a74665 03-May-2010 Anders Carlsson <andersca@mac.com> Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
155ed4a23366f4514befb1c9f5f89d16f8b8b6db 03-May-2010 Anders Carlsson <andersca@mac.com> Revert my last change and add a 'ForVirtualBase' parameter to EmitCXXConstructorCall instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
24eb78e38aba55c507bc3c05c37035a9ab2defa7 03-May-2010 Anders Carlsson <andersca@mac.com> Pass the construction kind down to EmitCXXConstructorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102880 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
82929316ccfcc1a7674f12195f93b41c91a28bd4 02-May-2010 Anders Carlsson <andersca@mac.com> Remove another unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
05dd1f6292bd39cbd75ef3dd641b5fc66b7c22ca 02-May-2010 Anders Carlsson <andersca@mac.com> Remove an unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
06a9f3680d22529a2fcf20c52d71cf221d99d910 01-May-2010 Douglas Gregor <dgregor@apple.com> Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators.

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

- For a class subobject, call the appropriate copy-assignment
operator, after overload resolution has determined what that is.
- For an array of scalar types or an array of class types that have
trivial copy assignment operators, construct a call to
__builtin_memcpy.
- For an array of class types with non-trivial copy assignment
operators, synthesize a (possibly nested!) for loop whose inner
statement calls the copy constructor.
- For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bfe7e91c1297f6f8c033790f64e59f0a1c9f6b3e 01-May-2010 Anders Carlsson <andersca@mac.com> Simplify EmitCopyCtorCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
43db20e9550ecf2b215ddb76eaff82a3b466de96 01-May-2010 Anders Carlsson <andersca@mac.com> Simplify EmitClassAggrMemberwiseCopy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f62756f45b5254ba7faa4e5cd848b4ad08c18824 01-May-2010 Anders Carlsson <andersca@mac.com> Clean up EmitClassMemberwiseCopy further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1d1d1185b46173107f5292a16e3a6ca4d60f7486 01-May-2010 Anders Carlsson <andersca@mac.com> Get rid of a parameter from EmitClassMemberwiseCopy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
59b7f1538d9d4c4f7c3932e3e3f95d2cb0fca7e4 01-May-2010 Anders Carlsson <andersca@mac.com> When defining implicit copy constructors, use SetBaseOrMemberInitializers to initialize the bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
106d9ea61c7211b370c5b97a0288652c23da329a 30-Apr-2010 Anders Carlsson <andersca@mac.com> Remove an unnecessary parameter from EmitClassCopyAssignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102747 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c743571e24c864b5930ef1290d71b03ccfde80a1 30-Apr-2010 John McCall <rjmccall@apple.com> Account for the VTT argument when making an implicit copy constructor for
a class with virtual bases. Just a patch until Sema starts (correctly) doing
most of this analysis.

Fixes PR 6622.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f406d9c68762163cf817230bca13030e4d10514e 30-Apr-2010 Anders Carlsson <andersca@mac.com> Get the base class addresses before calling EmitClassCopyAssignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9ffdd45c56e2f143016f6c78fe2d7ca652c1b57a 30-Apr-2010 Anders Carlsson <andersca@mac.com> Remove an unnecessary argument to EmitClassCopyAssignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
96754665707fd0273f0caa7023947fe470e8dc32 25-Apr-2010 Anders Carlsson <andersca@mac.com> Land another cleanup patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8e142ccf1196c9ae31f10f9caa97670e343971e7 25-Apr-2010 Anders Carlsson <andersca@mac.com> Revert enough of my patches to fix self-host again :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
df1147e6d4f8079253ddd91eaada844c2481b870 25-Apr-2010 Anders Carlsson <andersca@mac.com> Cleanup SynthesizeCXXCopyConstructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5f7cc730d7a284e88ef3980b85e17dde6b34144d 25-Apr-2010 Anders Carlsson <andersca@mac.com> Clean up SynthesizeCXXCopyAssignment a little.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102285 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8561a8666c70f924c8f0209c41b9b77bbbf90607 25-Apr-2010 Anders Carlsson <andersca@mac.com> RenameGetAddressOfBaseOfCompleteClass to GetAddressOfDirectBaseInCompleteClass to reflect that it only handles direct bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
f500de5bdfa1ab8e6944bb3519c2ae27f87c414b 25-Apr-2010 Anders Carlsson <andersca@mac.com> More cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
6444c417b4e8eaf1893c641f5a246f5adbb761c4 25-Apr-2010 Anders Carlsson <andersca@mac.com> Simplify EmitClassMemberwiseCopy now that it's only used for fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e127abe8bbcff7fef0326d68731bc178182a9990 25-Apr-2010 Anders Carlsson <andersca@mac.com> DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a88ad5618fcb07c5374c79d6781a33234984b039 24-Apr-2010 Anders Carlsson <andersca@mac.com> Rename GetAddressOfBaseClass to OldGetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e04d45e05277ee04997fe59b1d194503f484c846 24-Apr-2010 Anders Carlsson <andersca@mac.com> Get rid of the old GetNonVirtualBaseClassOffset and change all call sites to use the new version.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a04efdf635d35d88e65041fad007225d8c8d64a5 24-Apr-2010 Anders Carlsson <andersca@mac.com> Change CodeGenFunction::GetAddressOfDerivedClass to take a BasePath.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
fc89c31a329eb6b36c6dbd8b7cb945d1a831650e 24-Apr-2010 Anders Carlsson <andersca@mac.com> Convert more call sites over to the new GetAddressOfBaseClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
34a2d384c745ebc39cae45dc1c0c4a6a7012e09b 24-Apr-2010 Anders Carlsson <andersca@mac.com> Add a new GetAddressOfBaseClass overload that takes a base path and. Use it for derived-to-base casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c2a9b7973922cab0c0c56d46829d232ce3f4aacf 21-Apr-2010 Anders Carlsson <andersca@mac.com> Comment out an assert for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3e79c30807c516e8d32e4ed08408b30605df5997 20-Apr-2010 Anders Carlsson <andersca@mac.com> Back out r101911 and see if it makes the bots happy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
36fd6beef1ffaf93217d8ce96d900d4ed817e463 20-Apr-2010 Anders Carlsson <andersca@mac.com> Fix a bug which triggered the assertion I added yesterday. Basically, when we initialize the vtable pointer for a virtual base, and there was another path from the most derived class to another base with the same class type, we would use the wrong base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9dc228a1b971aa884766a9bdfdf5fa8ee4730b5b 20-Apr-2010 Anders Carlsson <andersca@mac.com> Move code to apply a non-virtual and virtual offset out into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b3b772ea15a4cd54879e244629aa685ead9548bb 20-Apr-2010 Anders Carlsson <andersca@mac.com> Pass the nearest virtual base decl to InitializeVTablePointers. No functionality change right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
2692d8284c77eee8ef3a93bf114cfec997a191a1 20-Apr-2010 Anders Carlsson <andersca@mac.com> Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
16573fa9705b546b7597c273b25b85d6321e2b33 20-Apr-2010 Douglas Gregor <dgregor@apple.com> Keep track of the actual storage specifier written on a variable or
function declaration, since it may end up being changed (e.g.,
"extern" can become "static" if a prior declaration was static). Patch
by Enea Zaffanella and Paolo Bolzoni.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
80638c5e6395344c1e6096542b0ff3b8bfb2139e 12-Apr-2010 Anders Carlsson <andersca@mac.com> Have the CXXBaseOrMemberInitializer keep track of whether an initializer initializes a virtual base or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
264ba48dc98f3f843935a485d5b086f7e0fdc4f1 30-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> the big refactoring bits of PR3782.

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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bfb7a1d6eba6714bd71db921092332da65b774c0 30-Mar-2010 Anders Carlsson <andersca@mac.com> Remove the old vtable layout code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8887bdcd4056ac25cb37dcb2abb9514e668eb81a 30-Mar-2010 Anders Carlsson <andersca@mac.com> Use the new function in EmitClassAggrMemberwiseCopy, fixing the same assert as seen in PR6628 but for arrays this time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
21c9ad9d29d08a287292c670e7c52bc522c7f8bb 30-Mar-2010 Anders Carlsson <andersca@mac.com> Factor emitting a call to a copy constructor out into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
44ec82b4a1597802f5bf17721481b8c265bc8dc5 30-Mar-2010 Anders Carlsson <andersca@mac.com> Introduce a CXXTemporariesCleanupScope RAII object and use it to cleanup the temporaries code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
46bbf8d352fcd615420c5759a112ccd6e61516ad 30-Mar-2010 Anders Carlsson <andersca@mac.com> Handle default arguments when calling copy constructors for bases or members when synthesizing a copy constructor. Fixes PR6628.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
851853d8b71f5bf2f24705c8dc2df54b2af88d71 29-Mar-2010 Anders Carlsson <andersca@mac.com> Flip the switch to always get vtables from the VTT when necessary, I've verified that clang bootstraps with this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
64c9eca97e06d80960d8782769661904e261ac29 29-Mar-2010 Anders Carlsson <andersca@mac.com> Cleanup, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
14da9de3ad9a451ed58f0196eea945c8393d5762 29-Mar-2010 Anders Carlsson <andersca@mac.com> Fix another thinko, so that flags don't depend on previous bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
b358814a25a75657f7f80ee9e198834da873c76e 29-Mar-2010 Anders Carlsson <andersca@mac.com> When generating base ctors/dtors, we need to lookup virtual bases using the vtable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c83f1061fedc223ad661e25337cc853f54671d8a 29-Mar-2010 Anders Carlsson <andersca@mac.com> Use construction vtables when needed. This is currently guarded by -fdump-vtable-layouts since it doesn't work 100% yet :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
603d6d12cc4cba1ef219a3d55c698c7c87f87adf 28-Mar-2010 Anders Carlsson <andersca@mac.com> Reapply r99775 with a fix for a silly bug - we were setting the vtable pointer for all bases, even those without a vtable pointer :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
4658990ac17046bfe7a30c45c9faea9e617eb479 28-Mar-2010 Anders Carlsson <andersca@mac.com> Looks like I broke self-host again :(.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bdb88655204ec14a20e51210bd50e84fe2f1cee9 28-Mar-2010 Anders Carlsson <andersca@mac.com> More improvements to setting the vtable pointer. We now no longer set the vtable pointer for non-virtual primary bases. We also do a pre-order traversal of the class hierarchy; this is necessary in order to get the right vbase offset offsets in base ctors/dtors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
d103f9f9b401b419e756f8c1849683cd77586067 28-Mar-2010 Anders Carlsson <andersca@mac.com> Factor vtable pointer setting code out into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
94e8ee520a00dcbdc896df07973d68f5ec7fdac8 26-Mar-2010 Anders Carlsson <andersca@mac.com> Revert r99612 and see if it fixes self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c2d526e4b2fa1cda43e614d80c9fc156f2874996 26-Mar-2010 Anders Carlsson <andersca@mac.com> Don't initialize virtual pointers for primary bases, they've already been initialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
0703690603bd197b581ceb2fb9a020aa88b9a106 26-Mar-2010 Anders Carlsson <andersca@mac.com> Simplify InitializeVtablePtrs in preparation of making it work with construction vtables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99609 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5eea8768b7a659825a46d7e55730a75282231a6f 24-Mar-2010 Anders Carlsson <andersca@mac.com> Use getNamedGlobal instead of getGlobalVariable. (Fixes self-host).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99385 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5c6c1d9eca7ce932eff011cd3e592f606e60b4be 24-Mar-2010 Anders Carlsson <andersca@mac.com> More vtable work; preparations for moving over to the new vtable layout code (finally).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99381 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
af4403545a50a60d208e6fcae057308d576a92e0 23-Mar-2010 Anders Carlsson <andersca@mac.com> Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bba16079eed1f3c8cd141685ecfaec9e78e07e35 11-Mar-2010 Anders Carlsson <andersca@mac.com> Rename getVirtualBaseOffsetIndex to getVirtualBaseOffsetOffset to reflect what it actually does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c0bf462cf35fe050bddbd8bff967298e4a67e79d 23-Feb-2010 John McCall <rjmccall@apple.com> Perform two more constructor/destructor code-size optimizations:

1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.

2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).

These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9fc6a7774643a810c8501dae2323e863fefb623e 19-Feb-2010 John McCall <rjmccall@apple.com> More refactoring around constructor/destructor code generation.
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.

This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3b47733ceac33306bd54ce9d6c7d8eeeae52c7ca 18-Feb-2010 John McCall <rjmccall@apple.com> Make deleting and complete dtor variants defer to other dtor variants by
calling them as subroutines. This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a355e07454463b19829ac92ffd115a097faff0e0 18-Feb-2010 John McCall <rjmccall@apple.com> Extract out function-body code generation into its own method. No functionality
change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
2504941793b549323f9d29c62507cf21d865fade 16-Feb-2010 John McCall <rjmccall@apple.com> IRgen optimization: cache the value of 'this' and 'vtt' instead of
repeatedly reloading from an alloca. We still need to create the alloca
for debug info purposes (although we currently create it in all cases
because of some abstraction boundaries that're hard to break down).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bff225ecf77fb891596ecb1b27196310d268365e 16-Feb-2010 John McCall <rjmccall@apple.com> When emitting complete destructors for classes with virtual bases, compute
the offset to the virtual bases statically inside of relying on the virtual
base offsets in the object's vtable(s). This is both more efficient and
sound against the destructor's manipulation of the vtables.

Also extract a few helper routines.

Oh and we seem to pass all tests with an optimized clang now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
1851a12605bc6f1ea70d11974a315340ebaab6eb 07-Feb-2010 Anders Carlsson <andersca@mac.com> Make sure to set vtable pointers in the destructors as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
594d5e8bd9870080aad6a761538e272bc2dfcc13 06-Feb-2010 Anders Carlsson <andersca@mac.com> Call destructors for constructed bases as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9405dcd83f090d86d5d06ab3a4e59cc39e7edd93 06-Feb-2010 Anders Carlsson <andersca@mac.com> If a constructor throws an exception we need to execute the destructors for all fully constructed members. Fixes ctor_dtor_count.cpp in the test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
eafd1d60fdf4ad076aae64d148046251344ffb13 06-Feb-2010 Ted Kremenek <kremenek@apple.com> Remove unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95476 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8b6bbeb2a3eb59df77ce69f4eeb28aa6a81015ea 06-Feb-2010 John McCall <rjmccall@apple.com> Rearrange some checks to avoid call to isCopyConstructor() and clarify path
taken for non-trivial constructors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
04a67a6aa3dfdc92d57f7f8d93ba397348c868a4 05-Feb-2010 John McCall <rjmccall@apple.com> Standardize the parsing of function type attributes in a way that
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().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a64a869312066ff6119d1d7ae03f88ce499e3f82 03-Feb-2010 Anders Carlsson <andersca@mac.com> Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a78fa2c40fbbe505485e7d120dc68a292ee0c968 02-Feb-2010 Anders Carlsson <andersca@mac.com> Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3bb9412788e04755cb509ec576f41afbed4efdd3 31-Jan-2010 Eli Friedman <eli.friedman@gmail.com> Simplify EmitMemberInitializer; no intended functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9db7dbb918ca49f4ee6c181e4917e7b6ec547353 31-Jan-2010 Douglas Gregor <dgregor@apple.com> Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

- CXXBaseOrMemberInitializer now contains only a single initializer
rather than a set of initialiation arguments + a constructor. The
single initializer covers all aspects of initialization, including
constructor calls as necessary but also cleanup of temporaries
created by the initializer (which we never handled
before!).

- Rework + simplify code generation for CXXBaseOrMemberInitializers,
since we can now just emit the initializer as an initializer.

- Switched base and member initialization over to the new
initialization code (InitializationSequence), so that it

- Improved diagnostics for the new initialization code when
initializing bases and members, to match the diagnostics produced
by the previous (special-purpose) code.

- Simplify the representation of type-checked constructor initializers in
templates; instead of keeping the fully-type-checked AST, which is
rather hard to undo at template instantiation time, throw away the
type-checked AST and store the raw expressions in the AST. This
simplifies instantiation, but loses a little but of information in
the AST.

- When type-checking implicit base or member initializers within a
dependent context, don't add the generated initializers into the
AST, because they'll look like they were explicit.

- Record in CXXConstructExpr when the constructor call is to
initialize a base class, so that CodeGen does not have to infer it
from context. This ensures that we call the right kind of
constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

- Diagnose default-initialization of a const-qualified class that
does not have a user-declared default constructor. We had this
diagnostic specifically for bases and members, but missed it for
variables. That's fixed now.

- When defining the implicit constructors, destructor, and
copy-assignment operator, set the CurContext to that constructor
when we're defining the body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
905a100f3d03039f6f3e3aecf2996a05cef4a267 31-Jan-2010 Anders Carlsson <andersca@mac.com> When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
a552ea76b0e4ce4ccdbb845667f0a12da6608c52 31-Jan-2010 Anders Carlsson <andersca@mac.com> When doing a base-to-derived cast we don't need to null check the derived value if the class offset is 0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94939 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
bb7e17b52ffaa4097b4c4d7935746d23539ffe2a 31-Jan-2010 Anders Carlsson <andersca@mac.com> Some class related cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94938 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9cfe0ec4decfd19a0387bb737f28eb0ea2c3a476 29-Jan-2010 Anders Carlsson <andersca@mac.com> Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
06a2970e9480c6d02b367b2f970baff29b9f9721 29-Jan-2010 Anders Carlsson <andersca@mac.com> Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
e6d2a534851a649485cb087e9dfcaf8a65886858 29-Jan-2010 Anders Carlsson <andersca@mac.com> Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8a850baa41ea9015b949183667ad96a981f10b09 15-Jan-2010 Eli Friedman <eli.friedman@gmail.com> Fix a couple bugs in copy assignment operator synthesis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
21431c551d867962c66c92f0f96f652678f64c1c 02-Jan-2010 Anders Carlsson <andersca@mac.com> Move address points to CGVtableInfo, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
c997d4278d329e18891aac9698fb991b2d4622eb 02-Jan-2010 Anders Carlsson <andersca@mac.com> Correctly pass VTT parameters to constructors and destructors. The VTTs aren't yet used in the ctors/dtors, but that will follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92409 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
3b5ad2283c999f6edf7d42332a655447b7386b2e 01-Jan-2010 Anders Carlsson <andersca@mac.com> Move a few more functions away from CGCXX and to CGClass and CGExprCXX.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
607d037c3f4376cbc8979d0eb9cd2f49a58ea033 24-Dec-2009 Anders Carlsson <andersca@mac.com> Move a bunch of class related functions to CGClass.cpp, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
9fcfc421d3bf124beed5b185b8d6d795edcbf83a 03-Dec-2009 Anders Carlsson <andersca@mac.com> Add CodeGenModule::ComputeThunkAdjustment, which Eli wrote.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
fa3e82ba04d175c89d622440def682f651542061 28-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Tests now pass with the assertion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
8432f25cb242cbc809f9b10672e8e2074d362f80 28-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Add a much more thorough test of casts to virtual bases, and fix
GetCXXBaseClassOffset to actually pass the test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp
5b955920c1d8f2cd35aae3c85b656578286a8bc1 24-Nov-2009 Anders Carlsson <andersca@mac.com> Get rid of the ugly CGCXX names and replace them with CGClass, CGExprCXX and CGTemporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/CodeGen/CGClass.cpp