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

299 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 131038e212 Use EmitCallArgs in EmitObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 20:29:27 +00:00
Douglas Gregor 7297134f12 FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 00:02:19 +00:00
Daniel Dunbar 0e4f40e1bb Attributes on block functions were not being set.
- <rdar://problem/6800351> clang not producing correct large struct
   return code for Blocks


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69337 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 00:48:04 +00:00
Daniel Dunbar b11fa0d25d Update to use hasAttr() instead of getAttr().
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 21:08:27 +00:00
Anders Carlsson 782f397c14 Use the new EmitCallArgs function. No indented functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68652 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 23:13:16 +00:00
Steve Naroff 33fdb738a6 Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change.
Changed GenerateConstantString() to take an ObjCStringLiteral (instead of a std::string). While this isn't strictly necessary, it seems cleaner and allows us to cache to "containsNonAscii" if necessary (to avoid checking in both Sema and CodeGen).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68114 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 16:53:37 +00:00
Chris Lattner 7e24e82a70 rename some methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 06:33:19 +00:00
Chris Lattner 74391b48b4 pull "runtime globals" into the same framework as other functions/global variables.
No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67478 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 21:03:39 +00:00
Mike Stump 6cc88f78fd Fix codegen for support for super inside block literal expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 21:53:12 +00:00
Fariborz Jahanian f469557743 More super dot-syntax property implementation
when there is actually a property declaration
used in the dot-syntax.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67391 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 19:18:21 +00:00
Fariborz Jahanian 8e5d23236a Implement ir gen. for setter/getter applied to 'super'
in a property dot-syntax notation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 17:22:23 +00:00
Fariborz Jahanian 3523d4f59e ir-gen support for class getter/setter call
using property dot-syntax.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66556 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:03:11 +00:00
Fariborz Jahanian ed1d29d625 Fixed an ir-gen bug in syntheszing a getter function
with property type which does not match its ivar and
in -fobjc-gc-only mode!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03 18:49:40 +00:00
Fariborz Jahanian 7ce77920a3 Obscure code gen bug related to sending
message to 'super' in a class method declared in
cateogy (darwin specific).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 20:07:56 +00:00
Devang Patel 1d6a451cee Enable debug info emission for objc methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 01:09:46 +00:00
Chris Lattner 89951a86b5 remove some more methods from objc decls, using the iterator
interfaces more consistently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 18:43:26 +00:00
Anders Carlsson e4b6d342c2 Start removing the old Obj-C EH stack now that the cleanup stack is used instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 05:52:02 +00:00
Mike Stump 3e9da66ac7 Ensure we track all the stack depths for all break and continue points
correctly.  This should lay the ground work to throw the big switch
and start code gening break and continue in the presense of vlas.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64046 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 23:02:10 +00:00
Mike Stump 501af1f721 Ensure that we don't miscodegen if vlas creap into the top of the for.
This will allow us to generate break and continue even if vlas are
involved without worry that we'll silently generate bad code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 20:09:00 +00:00
Mike Stump 36a2ada69f Fixup goto codegen in and around VLAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-07 12:52:26 +00:00
Daniel Dunbar 90350b6f81 Use correct signature for calling enumeration mutation function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63782 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 22:00:33 +00:00
Daniel Dunbar be395f6b29 Update passing of _Bool values to match what function was declared to take.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 00:55:44 +00:00
Daniel Dunbar 2b2105e92f Use CGCall infrastructure to call enumeration mutation function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 23:55:40 +00:00
Daniel Dunbar e4be5a6607 Fix return type for calls to objc_setProperty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 23:43:59 +00:00
Fariborz Jahanian 45012a7ef5 objc2's ir-gen for nonfragile ivar access.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 00:09:52 +00:00
Daniel Dunbar 541b63b1a9 Thread CGFunctionInfo construction through CodeGenTypes.
- Inefficient & leaks memory currently, will be cleaned up subsequently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63567 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 23:23:47 +00:00
Daniel Dunbar 88b5396b08 More ABI API cleanup.
- Lift CGFunctionInfo creation above ReturnTypeUsesSret and
   EmitFunction{Epi,Pro}log.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 22:03:45 +00:00
Daniel Dunbar bb36d331f4 ABI handling API changes.
- Lift CGFunctionInfo creation up to callers of EmitCall.

 - Move isVariadic bit out of CGFunctionInfo, take as argument to
   GetFunctionType instead.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 21:43:58 +00:00
Douglas Gregor 4afa39deaa Remove ScopedDecl, collapsing all of its functionality into Decl, so
that every declaration lives inside a DeclContext.

Moved several things that don't have names but were ScopedDecls (and,
therefore, NamedDecls) to inherit from Decl rather than NamedDecl,
including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't
store empty DeclarationNames for these things, nor do we try to insert
them into DeclContext's lookup structure.

The serialization tests are temporarily disabled. We'll re-enable them
once we've sorted out the remaining ownership/serialiazation issues
between DeclContexts and TranslationUnion, DeclGroups, etc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 01:17:11 +00:00
Daniel Dunbar f479cea608 Attempt to unbreak Windows build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 01:50:29 +00:00
Daniel Dunbar f185319f25 Fix some unused variable, control reaches end of non-void function,
and uninitialized use options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62270 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 18:32:35 +00:00
Steve Naroff 489034cf8b Fix a misleading comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-10 22:55:25 +00:00
Fariborz Jahanian 679a502d46 This patch fixes the code gen failures which was a fallout from
not merging protocol properties into the classes which
use those protocols. With this patch, all my exceutable
test pass again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62030 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-10 21:06:09 +00:00
Fariborz Jahanian 57966fc007 assert if attempting to code gen. a property setter/getter
coming from a protocol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-10 00:13:01 +00:00
Fariborz Jahanian f0906c4edb Couple of code gen. fixes in ObjC's colection-statement. Hard
to track down, easy to fix. This is on going.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06 18:56:31 +00:00
Fariborz Jahanian efc4c4bdbd Removed a slot in ObjCMemRegExpr used in
code gen which did not belong there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 17:29:46 +00:00
Fariborz Jahanian fd64bb635d Code gen. for ivar references; including bitfield
ivars.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 20:35:07 +00:00
Anders Carlsson e21269bcb7 Store the size of the EH stack inside each BreakContinue struct so we know when a break/continue won't cross a try block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 22:52:24 +00:00
Fariborz Jahanian aaa63a761c Patch for ObjCIvarRefExpr containing the field
matching the storage layout for this ivar


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 22:20:28 +00:00
Fariborz Jahanian fef30b5523 Support for implementation of property in the case where
the synthesis is in an implementation of s subclass of
a super class where the property has been declared.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 20:23:04 +00:00
Fariborz Jahanian 447d7aeb94 Change condition under which 'retain'/'copy' are directly evaluated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60729 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 23:56:17 +00:00
Fariborz Jahanian 6010bca98a Code gen for aggregate-valued properties and a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:36:09 +00:00
Daniel Dunbar 71fcec9abf Fix 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 21:53:21 +00:00
Fariborz Jahanian 43f447098d Implemented ir-gen for 'implicit' properties using the new AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 22:30:21 +00:00
Fariborz Jahanian 5daf570d0c New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties.
This is work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 18:39:36 +00:00
Fariborz Jahanian bd71be4683 Consolidated @try and @synchronize into a single
code gen. method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 00:49:24 +00:00
Chris Lattner 92e62b0222 Rename IdentifierInfo::isName to ::isStr. Use a nifty trick
from Sebastian to enforce that a literal string is passed in,
and use this to avoid having to call strlen on it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 04:42:34 +00:00
Chris Lattner f089551542 fix save-o
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:26:36 +00:00
Chris Lattner 865732239a simplify
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:24:49 +00:00
Chris Lattner 0a14eee528 This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how 
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and 
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the 
accumulated DiagnosticInfo is allowed to keep pointers to other expression 
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just 
strings) in a type-safe way.  Go operator overloading?!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:04:44 +00:00
Chris Lattner 10cac6f711 Start implementing support for @synchonized with the darwin ObjC API.
Patch by Fariborz!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 21:26:17 +00:00
Daniel Dunbar a448fb2da0 Rework IRgen invariant w.r.t. current insert point.
- EmitStmt is no longer required to finish with a current insertion
   point defined (i.e. it does not need to make dummy
   blocks). Instead, it can clear the insertion point in the builder
   which indicates that the current insertion point is unreachable.
 - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
   which respectively test if there is an insert point and ensure an
   insertion point exists (by making a dummy block).
 - Clearly mark functions in CodeGenFunction which can be called with
   no insertion point defined. Currently this is a limited set, and
   EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.

Remove EmitDummyBlock, which is no longer needed. Clients who haven't
already cleared the insertion point (typically via EmitBranch) can do
so by hand.

Remove isDummyBlock, which has effectively been renamed to
HaveInsertPoint.

The main thrust of this change is that we no longer have create dummy
blocks just to destroy them a short time later in EmitBlock in the
common case that there is no unreachable code following something like
a goto. 

Additionally, this means that we are not using the hokey condition in
isDummyBlock that a block without a name is a dummy block. Guess how
well that works when we never emit block names!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 23:11:34 +00:00
Daniel Dunbar 55e874299f Centralize basic block creation in CodeGenFunction::createBasicBlock.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 02:29:29 +00:00
Douglas Gregor cd9b46e544 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:56:14 +00:00
Daniel Dunbar 2284ac9ec8 Debug info bug fix, function start wasn't getting generated correctly
for Obj-C methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57769 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 18:22:23 +00:00
Chris Lattner 3304e55f61 silence release-assert warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57392 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 00:31:50 +00:00
Ted Kremenek 39741cecde Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of an Objective-C foreach statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 20:59:48 +00:00
Daniel Dunbar 86957eb200 Implement Obj-C synthesized setters for copy / retain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56547 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 06:32:09 +00:00
Daniel Dunbar c1cf4a579f Implement Obj-C getter synthesis for copy and retain.
Also, "simple" getter synthesis no longer uses temporary AST objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 04:04:31 +00:00
Anders Carlsson dde0a94120 Make sure to store the exception in the catch parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 09:15:33 +00:00
Anders Carlsson 1452f5599d Make sure to emit the catch parameter as well as the catch body.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 08:21:54 +00:00
Daniel Dunbar 7c086516f3 Factor CodeGenFunction::StartFunction out of GenerateCode and
StartObjCMethod.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:14:03 +00:00
Daniel Dunbar 5ca2084cf9 Use a unified return block.
- For the time being this means our emitted code is somewhat worse,
   especially for aggregates. This will be fixed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:00:17 +00:00
Anders Carlsson 64d5d6c590 Move handling of @try and @throw to the runtime class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 10:04:29 +00:00
Daniel Dunbar 46f45b9bec Change CodeGen to emit calls using (RValue,Type) list:
- Add CodeGenFunction::EmitAnyExprToTemp
   o Like EmitAnyExpr, but emits aggregates to a temporary location if
     none is available. Seems like this should be simpler (even aside
     from using first class aggregates).

 - Killed CodeGenFunction::EmitCallArg (just append the pair)

 - Conversion of RValues to actual call arguments is now isolated in
   CodeGenFunction::EmitCall.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 01:06:48 +00:00
Daniel Dunbar f80519b919 Set function attributes (sext, zext, etc.) on Objective-C methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 23:41:35 +00:00
Daniel Dunbar fe2b2c0898 Fix infinite loop in for ... in code generation.
- Patch via Thomas Clement, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 21:54:37 +00:00
Daniel Dunbar e66f4e3e3a Fix ObjCPropertRefExpr to be able to encode all the information for
uses which refer to methods not properties.
 - Not yet wired in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 00:27:26 +00:00
Anders Carlsson 2abd89c039 Handle mutation while enumerating correctly. Fix some bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-31 04:05:03 +00:00
Anders Carlsson f484c31f4d Initial support for CodeGen of for ... in statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-31 02:33:12 +00:00
Anders Carlsson 3d8400d9a6 Stub out CodeGenFunction::EmitObjCForCollectionStmt.
Add CodeGenFunction::EmitMemSetToZero and make AggExprEmitter::EmitAggregateClear use it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 19:51:14 +00:00
Daniel Dunbar 7f8ea5c5b3 Add Objective-C property setter support.
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
   favor of just result type and selector. Necessary so it can be
   reused in situations where we don't want to cons up an
   ObjCMessageExpr.
 - Update aggregate binary assignment to know about special property
   ref lvalues.
 - Add CodeGenFunction::EmitCallArg overload which takes an already
   emitted rvalue.

Add CodeGenFunction::StoreComplexIntoAddr.

Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.

Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 05:35:15 +00:00
Daniel Dunbar 19cd87eb5f Refactor handling of calls:
- Added CodeGenFunction::EmitCall which just takes the callee, return
   type, and a list of (Value*,QualType) pairs.
 - Added CodeGenFunction::EmitCallArg which handles emitting code for
   a call argument and turning it into an appropriate
   (Value*,QualType) pair.
 - Changed Objective-C runtime interface so that the actual emission
   of arguments for message sends is (once again) done in the code to
   emit a message send.

No intended functionality change, this is prep work for better ABI
support and for Objective-C property setter support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 03:02:31 +00:00
Daniel Dunbar 85c59edda0 Add special "property reference" CodeGen::LValue type for emitting
Objective-C property references.
 - This handles property references "more correctly" but setters still
   don't work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 08:11:39 +00:00
Daniel Dunbar 9c3fc703b2 Initial support for Obj-C dot-syntax for getters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 06:57:25 +00:00
Daniel Dunbar af05bb9073 Objective-C @synthesize support.
- Only supports simple assignment and atomic semantics are ignored.
 - Not quite usable yet because the methods do not actually get added
   to the class metadata.
 - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain).
 - Rearrange CodeGenFunction so synthesis can reuse function prolog /
   epilog code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 08:29:31 +00:00
Daniel Dunbar f56f1913e9 Fix Obj-C super sends inside class methods.
- NeXT loads the super class at runtime; this required changing the
   runtime interface to pass more information down.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 08:19:24 +00:00
Daniel Dunbar 8f2926b73e Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
 - Reduced to only taking the CodeGenFunction, Expr, and Receiver.
 - Becomes responsible for emitting the arguments.

Add CodeGenFunction::EmitCallExprExt
 - Takes optional extra arguments to insert at the head of the call.
 - This allows the Obj-C runtimes to call into this and isolates the
   argument and call instruction generation code to one place. Upshot
   is that we now pass structures (more) correctly.

Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 03:46:30 +00:00
Daniel Dunbar ed7c618f84 Move all Obj-C runtime interaction into CodeGenFunction.
- Drop duplicate (and broken) code for sending messages.
 - Add EmitObjCProtocolExpr to CodeGenFunction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:28:19 +00:00
Daniel Dunbar b7ec246872 Add NeXT runtime support for generating methods.
Change CodeGenFunction::EmitParmDecl to take either a ParmVarDecl or an
  ImplicitParamDecl.

Drop hasAggregateLLVMType from CodeGenModule.cpp (use version in
  CodeGenFunction).

Change the Objective-C method generation to use EmitParmDecl for
  implicit parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 03:19:19 +00:00
Daniel Dunbar ddb2a3d55a Change ObjCRuntime::LookupClass -> GetClass, and now takes the
ObjCInterfaceDecl.

Change ObjCRuntime::GenerateMessageSendSuper to take the
  ObjCInterfaceDecl for the super class, instead of just its name.

Change EmitObjCMessageExpr to make the right runtime calls for super
  sends in class methods (i.e. a super send with the class object as
  the receiver).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 00:25:02 +00:00
Daniel Dunbar 7ded7f4983 Change CGObjCRuntime methods to take appropriate clang Decls.
- This is in prep for implementation class support for the NeXT
   runtime, for which the existing methods don't provide enough
   information (and additionally make too many assumptions about how
   things should be emitted).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 22:20:32 +00:00
Daniel Dunbar 6143293fa4 Add GetAddrOfConstantCString method
- Returns addr of constant for argument + '\0'.
 - I couldn't think of a better name.
 - Move appropriate users of GetAddrOfConstantString to this.

Rename getStringForStringLiteral to GetStringForStringLiteral.

Add GetAddrOfConstantStringFromLiteral
 - This combines GetAddrOfConstantString and
   GetStringForStringLiteral. This method can be, but is not yet, more
   efficient.

Change GetAddrOfConstantString to not add terminating '\0'
 - <rdar://problem/6140956>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 23:20:05 +00:00
Daniel Dunbar 2bedbf8549 Drop Sender from GenerateMessageSend*
- Was unused and generated a unnecessary load of self

Update NeXT runtime to get proper object & selector types from
       ASTContext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 05:28:47 +00:00
Daniel Dunbar bbce49b9e5 Add ObjC constant string support for NeXT.
Changed CGObjCRuntime::GenerateConstantString interface to take
       std::string instead of char* and size.

Change ObjC functions which call on GenerateConstantString to bitcast
       result to appropriate type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 00:12:39 +00:00
Daniel Dunbar 208ff5e8a0 Change CodeGenModule to only create ObjC runtime for ObjC files
- Changed CodeGenModule::getObjCRuntime to return reference.
 - Added CodeGenModule::hasObjCRuntime predicate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 18:12:00 +00:00
Daniel Dunbar acc5f3e423 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 06:23:49 +00:00
Daniel Dunbar c4a1dea2dc More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
 - Moved Sema::getCurMethodDecl() out of line (dependent on
   ObjCMethodDecl via dyn_cast).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 05:35:13 +00:00
Chris Lattner d9f6910f4e rename PreDefinedExpr -> PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 01:53:14 +00:00
Chris Lattner 9384c768e9 avoid a lot of unneeded selector processing work by passing around
selectors instead of Value*'s.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:42:20 +00:00
Chris Lattner 42ba3e7ba1 use cheaper/simpler getselector call for @selector exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:38:58 +00:00
Chris Lattner 8e67b63530 start avoid doing lots of unneeded work handling selectors
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52758 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:37:12 +00:00
Chris Lattner 630404b16e Fix 80 col violations, assert on assumptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52755 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 04:10:42 +00:00
Chris Lattner 8fdf32822b "Support for Objective-C message sends which return structures. Also includes a small fix for constant string handling that should have been in the last patch (sorry!) and a hook for generating selectors (rest of this implementation to follow in the next patch)."
Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 17:04:18 +00:00
Chris Lattner 4111024be8 Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:05:57 +00:00
Steve Naroff f494b579b2 - Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
- #include ExprObjC.h in many places


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:12:08 +00:00
Ted Kremenek 2979ec73b4 The dtor CGObjCRuntime::~CGObjCRuntime() was implemented twice, once
in CGObjCGNU.cpp and once in CGObjCEtoile.cpp.  Moved its definition to
CGObjC.cpp.  This resolves a build error in Xcode, and also cleans things up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 15:51:31 +00:00
Chris Lattner 391d77a263 Add initial support for objc codegen for methods, ivars, and the
etoile runtime, patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 23:03:07 +00:00
Chris Lattner bda0b626e7 Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15 23:59:48 +00:00