Граф коммитов

198 Коммитов

Автор SHA1 Сообщение Дата
David Chisnall ab5824e976 Make the property accessor functions that take a ptrdiff_t actually take a ptrdiff_t instead of a long (should have no impact on any sane platforms, but win64 is not sane).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 20:03:13 +00:00
John McCall e81ac69c5d The emission of an Objective-C++'s class .cxx_destruct method should be
conditioned on whether it has any destructible ivars, not on whether
it has any non-trivial class-object initializers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128074 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 07:05:39 +00:00
John McCall d26bc76c98 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
2011-03-09 04:27:21 +00:00
Devang Patel aa11289f75 DebugInfo can be enabled or disabled at function level (e.g. using an attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127165 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:45:56 +00:00
Dan Gohman 361cf980a7 Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126890 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 22:39:34 +00:00
Tilmann Scheller 9c6082fe89 Revert "Add CC_Win64ThisCall and set it in the necessary places."
This reverts commit 126863.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126886 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 21:36:49 +00:00
Tilmann Scheller 88d117c2ee Add CC_Win64ThisCall and set it in the necessary places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126863 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 19:36:23 +00:00
John McCall 57b3b6a608 Establish the iteration variable of an ObjC for-in loop before
emitting the collection expression.  Fixes some really, really broken
code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 07:16:58 +00:00
Fariborz Jahanian 2846b97965 Objective-c armv7 API for atomic properties of
scalar types. // rdar://7761305


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125946 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 19:15:13 +00:00
Fariborz Jahanian b19c76e857 Fix an IRGen bug in property setter calls when
setter and getter types mismatch. // rdar://8966864


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:33:23 +00:00
Ken Dyck fe71008c27 Replace calls to getTypeSize() and getTypeAlign() with their 'InChars'
counterparts where char units are needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123805 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 01:58:38 +00:00
Devang Patel bcbd03ac0a Emit DW_TAG_lexical_scope to surround foreach.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123802 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 01:36:36 +00:00
Jeffrey Yasskin dec0984fce Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 02:00:16 +00:00
Peter Collingbourne 1411047788 Move name mangling support from CodeGen to AST. In the
process, perform a number of refactorings:

- Move MiscNameMangler member functions to MangleContext
- Remove GlobalDecl dependency from MangleContext
- Make MangleContext abstract and move Itanium/Microsoft functionality
  to their own classes/files
- Implement ASTContext::createMangleContext and have CodeGen use it

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 18:57:25 +00:00
Sean Hunt cbb6748009 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
2011-01-08 20:30:50 +00:00
John McCall d88687fc8b Rework a few things about how we emit ObjC's for enumeration statement.
In particular, the iteration variable (if present) should be created and
destroyed in a narrow span around the loop body, and the body should
be emitted in a cleanup scope in case it's not a compound statement.
Otherwise, rename a few variables and use phis instead of temporary
variables for the index and buffer count.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122988 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 01:49:06 +00:00
David Chisnall 8fac25d33b Add support for GNU runtime property set / get structure functions. Minor refactoring of Mac runtime (returns the same function for both, as the Mac runtimes currently only provide a single entry point for setting and getting struct properties, although this will presumably be fixed at some point).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122569 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-26 22:13:16 +00:00
John McCall 2a41637a99 Fix a bug in the emission of __real/__imag l-values on scalar operands.
Fix a bug in the emission of complex compound assignment l-values.
Introduce a method to emit an expression whose value isn't relevant.
Make that method evaluate its operand as an l-value if it is one.
Fixes our volatile compliance in C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-05 02:00:02 +00:00
Francois Pichet 00eb3f9c5b 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
2010-12-04 09:14:42 +00:00
John McCall e68b9842d2 Test case for the l-value base only being evaluated once.
Also, move the l-value emission code into CGObjC.cpp and teach it, for
completeness, to store away self for a super send.

Also, inline the super cases for property gets and sets and make them
use the correct result type for implicit getter/setter calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120887 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 03:11:00 +00:00
John McCall 119a1c6c40 Kill the KVC l-value kind and calculate the base expression when emitting
the l-value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120884 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 02:32:38 +00:00
John McCall 12f78a6741 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:19:52 +00:00
John McCall f89e55ab1b Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 06:31:45 +00:00
Fariborz Jahanian 8ac2d44982 Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 16:04:05 +00:00
John McCall 558d2abc7f 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
2010-09-15 10:14:12 +00:00
Fariborz Jahanian 0339d72d7f IRGen fix for using property-dot syntax to pass
reference object to a c++ member function.
fixes radar 8409336.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 18:56:35 +00:00
John McCall 2de56d1d0c GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 11:45:40 +00:00
John McCall 5baba9d983 More incremental progress towards not including Expr.h in Sema.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 10:28:54 +00:00
John McCall f871d0cc37 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
2010-08-07 06:22:56 +00:00
Fariborz Jahanian 3d4aeda910 Return type of a setter call caused by
use of property-dot syntax using 'super' as receiver
is 'void'. This fixes a bug in generating correct
API for setter call. Fixes radar 8203426.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109297 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-24 00:34:08 +00:00
John McCall ff8e11579f Revise cleanup IR generation to fix a major bug with cleanups (PR7686)
as well as some significant asymptotic inefficiencies with threading
multiple jumps through deep cleanups.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-23 21:56:41 +00:00
Sebastian Redl 906082edf2 Update ImplicitCastExpr to be able to represent an XValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108807 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 04:20:21 +00:00
John McCall f1549f66a8 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
2010-07-06 01:34:17 +00:00
Douglas Gregor 1d110e05e0 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
2010-07-01 14:13:13 +00:00
Anders Carlsson 7e70fb217d Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106477 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-21 20:59:55 +00:00
Fariborz Jahanian e2a901a188 When using property-dot assignment syntax to call a setter method,
type of rhs need be compared to setter's argument and
not the getter type. Fixes radar 8062778


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-07 22:02:01 +00:00
Anders Carlsson 1884eb0b5c Re-land the fix for PR7139.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 17:35:42 +00:00
John McCall ef072fd2f3 Push a return-value slot throughout ObjC message-send codegen. Will be
critical for ObjC++ correctness;  hard to test independently of various
required Sema changes, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 01:48:05 +00:00
Anders Carlsson 892fa6c5e1 Unbreak self-host.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 22:17:48 +00:00
Anders Carlsson db9b12e32c 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
2010-05-21 21:45:41 +00:00
John McCall ee5042903d Allocate space in a block record for implicit references to the Objective C
'self' variable arising from uses of the 'super' keyword.  Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.

Fixes rdar://problem/8010633.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 04:11:14 +00:00
John McCall 3031c63f7b Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-17 20:12:43 +00:00
John McCall c12c5bba6c Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 11:32:37 +00:00
Douglas Gregor 5077c3876b Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 06:01:05 +00:00
Fariborz Jahanian 97a73cd8e2 Code Gen support for Getter/Setter synthesis of
C++ object properties. (still radar 7468090).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 15:45:36 +00:00
Chandler Carruth bc397cf903 Clean up the {} and else placement. This fixes an ambiguous else as well as
picking a more consistent pattern.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-06 00:20:39 +00:00
Fariborz Jahanian 17cb326cb6 This patch deals with Sema Part of Setter/Getter synthesis
of properties which are of C++ objects. Code Gen to follow
(Radar 7468090).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 21:52:17 +00:00
Fariborz Jahanian 8b688ed1d5 Fixes a code gen. crash when ivar object has trivial constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-04 19:29:32 +00:00
Anders Carlsson 8e6404ca28 Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102882 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 23:29:11 +00:00
Fariborz Jahanian 9b4d4fc49f Support for construct/destruct of ivar array
of c++ objects (NeXt runtime).
radar 7900343.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 22:30:33 +00:00