summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Code gen. for ivar references; including bitfieldFariborz Jahanian2008-12-151-2/+5
| | | | | | ivars. llvm-svn: 61043
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Append an extra newline to the module inline asm if it's not empty.Anders Carlsson2008-12-101-0/+5
| | | | llvm-svn: 60827
* Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of Chris Lattner2008-11-241-28/+23
| | | | | | | | | | | uses of getName() with uses of getDeclName(). This upgrades a bunch of diags to take DeclNames instead of std::strings. This also tweaks a couple of diagnostics to be cleaner and changes CheckInitializerTypes/PerformInitializationByConstructor to pass around DeclarationNames instead of std::strings. llvm-svn: 59947
* Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make itChris Lattner2008-11-241-4/+3
| | | | | | | | | assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. llvm-svn: 59936
* Rename Selector::getName() to Selector::getAsString(), and addChris Lattner2008-11-241-9/+8
| | | | | | | | | | | | | a new NamedDecl::getAsString() method. Change uses of Selector::getName() to just pass in a Selector where possible (e.g. to diagnostics) instead of going through an std::string. This also adds new formatters for objcinstance and objcclass as described in the dox. llvm-svn: 59933
* Fixed bugzilla bug# 3095 related to code gen. for @synchronized.Fariborz Jahanian2008-11-211-7/+11
| | | | llvm-svn: 59838
* Consolidated @try and @synchronize into a singleFariborz Jahanian2008-11-211-101/+36
| | | | | | code gen. method. llvm-svn: 59767
* Introducing objc_assign_ivar to clang.Fariborz Jahanian2008-11-201-0/+23
| | | | llvm-svn: 59740
* Few more changes due to Daniel's feedback.Fariborz Jahanian2008-11-191-0/+7
| | | | llvm-svn: 59645
* Generate strong write barriers for __strong objects.Fariborz Jahanian2008-11-191-0/+26
| | | | | | Also, took care of Daniel's commments. llvm-svn: 59575
* Patch for generation of weak write barriers for objcFariborz Jahanian2008-11-181-4/+17
| | | | | | __weak objects. llvm-svn: 59560
* Generate objc_read_weak for __weak objc loads.Fariborz Jahanian2008-11-181-1/+13
| | | | llvm-svn: 59553
* Some basic support toward objective-c's GC code gen.Fariborz Jahanian2008-11-181-0/+47
| | | | llvm-svn: 59543
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-171-3/+3
| | | | | | | | representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. llvm-svn: 59441
* Start implementing support for @synchonized with the darwin ObjC API.Chris Lattner2008-11-151-1/+116
| | | | | | Patch by Fariborz! llvm-svn: 59377
* Rework IRgen invariant w.r.t. current insert point.Daniel Dunbar2008-11-111-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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! llvm-svn: 59089
* Add CodeGenFunction::EmitBranch.Daniel Dunbar2008-11-111-1/+1
| | | | | | | - Emits an unconditional branch, with extra logic to avoid generating spurious branches out of dummy blocks. llvm-svn: 59037
* Add CodeGenFunction::EmitDummyBlock for marking places where we makeDaniel Dunbar2008-11-111-1/+1
| | | | | | | "dummy" blocks (blocks just used to make sure we have a place to dump code to). llvm-svn: 59022
* Centralize basic block creation in CodeGenFunction::createBasicBlock.Daniel Dunbar2008-11-111-12/+12
| | | | | | - No functionality change. llvm-svn: 59017
* Move IRBuilder type definition to common file.Daniel Dunbar2008-11-011-11/+10
| | | | | | - No functionality change. llvm-svn: 58546
* NeXT: Emit protocol objects lazily.Daniel Dunbar2008-10-291-21/+76
| | | | | | | | | | - That is, the metadata for a protocol is only emitted if that protocol is actually used in the translation unit. This is important because Objective-C headers frequently contain a large number of protocol definitions, only a few of which will be used in any given file. llvm-svn: 58400
* Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.Daniel Dunbar2008-10-171-6/+2
| | | | llvm-svn: 57716
* More Obj-C type encoding improvements.Daniel Dunbar2008-10-171-1/+2
| | | | | | | - Encode unions and bit-fields correctly. - Accept option to name record fields (used for NeXT runtime). llvm-svn: 57685
* NeXT: Use objc_msgSend_fpret for calling functions which returnDaniel Dunbar2008-10-171-14/+40
| | | | | | floating point. This is only correct for x86-32 at the moment. llvm-svn: 57667
* Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when ↵Ted Kremenek2008-10-061-1/+1
| | | | | | processing the Decl of a @catch statement. llvm-svn: 57208
* (LLVM up) Rename IRBuilder::IsNonNull -> IsNotNull.Daniel Dunbar2008-10-021-3/+3
| | | | llvm-svn: 56954
* NeXT: Update to use CreateRuntimeFunction for the routines it imports.Daniel Dunbar2008-10-011-80/+54
| | | | llvm-svn: 56902
* Add infrastructure for proper @finally support.Daniel Dunbar2008-09-301-55/+101
| | | | | | | | | | | | - Provides a basic primitive to jump to an arbitrary basic block, through the finally code. - Only used for return statements and rethrow currently. Still need to handle break, continue and goto. - Code still needs to be shuffled around to live elsewhere. llvm-svn: 56827
* Add support for implicit rethrows in @catch blocks.Daniel Dunbar2008-09-281-9/+85
| | | | | | Comment exception-handling code generation strategy. llvm-svn: 56763
* (Update LLVM) Clean up obj-c exception generation to be a bit moreDaniel Dunbar2008-09-271-23/+15
| | | | | | readable and to generate more readable IR. llvm-svn: 56758
* Bug fix, codegen @catch(id<X> ...) acceptably.Daniel Dunbar2008-09-271-2/+5
| | | | | | | - This should be rejected by sema (IMHO) but that needs some investigation. llvm-svn: 56756
* Simplify generate code for exceptions: Daniel Dunbar2008-09-271-27/+15
| | | | | | | | | | | | | | | | | | | - There is no need to branch on the rethrow variable to determine if we need to call objc_exception_try_exit. We know whether an exception was thrown, so just branch to a different target if we want to skip the try_exit. This is a slight semantic departure from gcc, but only for throwing nil, which is undefined (and for which gcc emits broken code). - Also fixes a bug in current code which was calling try_exit too many times when an exception was uncaught (but there were some handlers). Fix bug introduced in prev. commit, the type of the @catch parameter was uninitialized. llvm-svn: 56754
* Bug fix, make sure to initialize exception object (to rethrow) evenDaniel Dunbar2008-09-271-38/+38
| | | | | | | | | | | when there are no @catch blocks. Also, eliminated unneeded alloca for the rethrow object. Also, avoid generating code to rethrow exception if the exception will trivially always be caught. llvm-svn: 56751
* Easy fix for nasty bug, exception data buffer had wrong type == wrongDaniel Dunbar2008-09-271-1/+1
| | | | | | (smaller) size == garbage on stack == heisenbugs. llvm-svn: 56750
* Implement Obj-C synthesized setters for copy / retain.Daniel Dunbar2008-09-241-1/+2
| | | | llvm-svn: 56547
* Add Obj-C runtime methods to get runtime specific functions forDaniel Dunbar2008-09-241-2/+42
| | | | | | implementing property access. llvm-svn: 56542
* Make sure to store the exception in the catch parameter.Anders Carlsson2008-09-111-8/+28
| | | | llvm-svn: 56102
* Make sure to emit the catch parameter as well as the catch body.Anders Carlsson2008-09-111-3/+4
| | | | llvm-svn: 56101
* Fix stupid mistake I made in the exception handling codeAnders Carlsson2008-09-111-1/+1
| | | | llvm-svn: 56100
* Add CodeGenTypes::GetFunctionType overload for getting the effectiveDaniel Dunbar2008-09-101-27/+10
| | | | | | | | | | | | type of a call. Change NeXT runtime to use this instead of trying to bitcasting internally (which doesn't respect the ABI). Fix subtle bug, use of ConvertTypeRecursive instead of ConvertType is bad inside GetFunctionType. llvm-svn: 56050
* Move FunctionType conversion into CGCall.cpp:Daniel Dunbar2008-09-101-51/+3
| | | | | | | | | | | | | - Added CodeGenTypes::GetFunctionType, taking a CGFunctionInfo. - Updated Obj-C runtimes to use this instead of rolling the llvm::FunctionType by hand. - Killed CodeGenTypes::{ConvertReturnType, DecodeArgumentTypes}. Add ABIArgInfo class to encapsulate ABI decision of how to lower types to LLVM. - Will move to target sometime soon. llvm-svn: 56047
* Tweak CGCall functions again:Daniel Dunbar2008-09-101-1/+1
| | | | | | | | - Realized these functions will eventually need access to more data, moved to CodeGenModule. Eventually they should probably live together in some other helper class. llvm-svn: 56039
* Add CodeGenFunction::ReturnTypeUsesSretDaniel Dunbar2008-09-091-9/+9
| | | | | | - Hook so NeXT runtime doesn't depend on ABI. llvm-svn: 56034
* Check in half-assed implementation of @try/@catch.Anders Carlsson2008-09-091-2/+164
| | | | llvm-svn: 55994
* Simple @throw support.Anders Carlsson2008-09-091-1/+12
| | | | llvm-svn: 55991
* Add types and functions related to exceptions.Anders Carlsson2008-09-091-0/+93
| | | | llvm-svn: 55984
* Move handling of @try and @throw to the runtime class.Anders Carlsson2008-09-091-0/+18
| | | | llvm-svn: 55983
* Change CodeGen to emit calls using (RValue,Type) list:Daniel Dunbar2008-09-091-3/+5
| | | | | | | | | | | | | | - 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. llvm-svn: 55970
* Change struct forward declarations and definitions to use unique ↵Ted Kremenek2008-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RecordDecls, as opposed to creating a single RecordDecl and reusing it. This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet). The motivation of this patch is as follows: - Capture more source information, necessary for refactoring/rewriting clients. - Pave the way to resolve ownership issues with RecordDecls with the forthcoming addition of DeclGroups. Current caveats: - Until DeclGroups are in place, we will leak RecordDecls not explicitly referenced by the AST. For example: typedef struct { ... } x; The RecordDecl for the struct will be leaked because the TypedefDecl doesn't refer to it. This will be solved with DeclGroups. - This patch also (temporarily) breaks CodeGen. More below. High-level changes: - As before, TagType still refers to a TagDecl, but it doesn't own it. When a struct/union/class is first referenced, a RecordType and RecordDecl are created for it, and the RecordType refers to that RecordDecl. Later, if a new RecordDecl is created, the pointer to a RecordDecl in RecordType is updated to point to the RecordDecl that defines the struct/union/class. - TagDecl and RecordDecl now how a method 'getDefinition()' to return the TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular enum/struct/class/union. This is useful from going from a RecordDecl* that defines a forward declaration to the RecordDecl* that provides the actual definition. Note that this also works for EnumDecls, except that in this case there is no distinction between forward declarations and definitions (yet). - Clients should no longer assume that 'isDefinition()' returns true from a RecordDecl if the corresponding struct/union/class has been defined. isDefinition() only returns true if a particular RecordDecl is the defining Decl. Use 'getDefinition()' instead to determine if a struct has been defined. - The main changes to Sema happen in ActOnTag. To make the changes more incremental, I split off the processing of enums and structs et al into two code paths. Enums use the original code path (which is in ActOnTag) and structs use the ActOnTagStruct. Eventually the two code paths will be merged, but the idea was to preserve the original logic both for comparison and not to change the logic for both enums and structs all at once. - There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls that correspond to the same type simply have a pointer to that type. If we need to figure out what are all the RecordDecls for a given type we can build a backmap. - The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the changes to RecordDecl. For some reason 'svn' marks the entire file as changed. Why is CodeGen broken: - Codegen assumes that there is an equivalence between RecordDecl* and RecordType*. This was true before because we only created one RecordDecl* for a given RecordType*, but it is no longer true. I believe this shouldn't be too hard to change, but the patch was big enough as it is. I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C). llvm-svn: 55839
OpenPOWER on IntegriCloud