summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
Commit message (Collapse)AuthorAgeFilesLines
* Adds support for generation of objc_memmove_collectable APIFariborz Jahanian2010-05-201-1/+5
| | | | | | in Objective-C++ mode. llvm-svn: 104281
* Copy construction of non-trivial properties must notFariborz Jahanian2010-05-202-8/+4
| | | | | | be turned into a setter call (fixes radar 8008649). llvm-svn: 104235
* Picky, pickyDouglas Gregor2010-05-201-1/+1
| | | | llvm-svn: 104230
* Fix a thinkoDouglas Gregor2010-05-201-1/+1
| | | | llvm-svn: 104229
* Assert that we do not try to memcpy a non-POD class type in C++. ThisDouglas Gregor2010-05-201-1/+7
| | | | | | | | | | | | | | particular issue was the cause of the Boost.Interprocess failures, and in general will lead to horrendous, hard-to-diagnose miscompiles. The assertion itself has survives self-host and a full Boost build, so we are close to eradicating this problem in C++. Note that the assertion is *not* turned on for Objective-C++, where we still have problems with introducing memcpy's of non-POD class types. That part of the assertion will go away as soon as we fix the known issues in Objective-C++. llvm-svn: 104227
* Fix my inability to spell 'continue' and a case where message sends ↵David Chisnall2010-05-201-4/+7
| | | | | | returning non-pointer-sized things were generating invalid IR inside @try blocks. llvm-svn: 104222
* Rework our handling of binding a reference to a temporaryDouglas Gregor2010-05-201-18/+100
| | | | | | | | | | | | | | | | | | | | subobject. Previously, we could only properly bind to a base class subobject while extending the lifetime of the complete object (of a derived type); for non-static data member subobjects, we could memcpy (!) the result and bind to that, which is rather broken. Now, we pull apart the expression that we're binding to, to figure out which subobject we're accessing, then construct the temporary object (adding a destruction if needed) and, finally, dig out the subobject we actually meant to access. This fixes yet another instance where we were memcpy'ing rather than doing the right thing. However, note the FIXME in references.cpp: there's more work to be done for binding to subobjects, since the AST is incorrectly modeling some member accesses in base classes as lvalues when they are really rvalues. llvm-svn: 104219
* When creating a this-adjustment thunk where the return value is of C++Douglas Gregor2010-05-201-2/+9
| | | | | | | | | class type (that uses a return slot), pass the return slot to the callee directly rather than allocating new storage and trying to copy the object. This appears to have been the cause of the remaining two Boost.Interprocess failures. llvm-svn: 104215
* Support implicitly closing on 'this' in a block. Fixed PR7165.John McCall2010-05-203-138/+200
| | | | | | (the codegen works here, too, but that's annoying to test without execution) llvm-svn: 104202
* Implement codegen for __builtin_isnormal.Benjamin Kramer2010-05-191-5/+19
| | | | llvm-svn: 104118
* Add support for Microsoft's __thiscall, from Steven Watanabe!Douglas Gregor2010-05-181-0/+4
| | | | llvm-svn: 104026
* Correctly initialize bases with member pointers. This should fix PR6441 but ↵Anders Carlsson2010-05-182-14/+139
| | | | | | that test case is a bit weird and I'd like to investigate further before closing that bug. llvm-svn: 104025
* Keep track of the LLVM field numbers for non-virtual bases.Anders Carlsson2010-05-182-4/+25
| | | | llvm-svn: 104013
* Start laying out bases as individual fields. We still use ugly i8 arrays but ↵Anders Carlsson2010-05-181-14/+61
| | | | | | this is a step in the right direction. llvm-svn: 104012
* Add CodeGenTypes::ContainsPointerToDataMember overload that takes a ↵Anders Carlsson2010-05-182-6/+15
| | | | | | CXXRecordDecl. llvm-svn: 104011
* Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointedJohn McCall2010-05-172-14/+14
| | | | | | out. The remaining ones are okay. llvm-svn: 103973
* Fix an ambiguous else warning from GCC by adding some much needed curlies.Chandler Carruth2010-05-171-2/+3
| | | | llvm-svn: 103972
* Correctly generate IR for ObjC messages sends to protocol-qualified types.John McCall2010-05-171-4/+5
| | | | | | Fixes rdar://problem/7992749 llvm-svn: 103965
* IRgen: Remove dead function.Daniel Dunbar2010-05-171-17/+0
| | | | llvm-svn: 103945
* C++/Darwin/i386 ABI: Fix some problems with empty record handling.Daniel Dunbar2010-05-171-3/+20
| | | | | | | | - Check bases as part of isEmptyRecord(). - C++ record fields are never empty in the Itanium ABI. llvm-svn: 103944
* Ensure that destructors are called for NRVO'd objects when theDouglas Gregor2010-05-173-3/+44
| | | | | | | function does not return. Thanks to Eli for pointing out this corner case. llvm-svn: 103941
* Pick the correct personality function based on the language. This prevents ↵David Chisnall2010-05-171-25/+26
| | | | | | | | link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function). This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass. The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future. llvm-svn: 103938
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-163-19/+76
| | | | | | | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures, along with the regressions that r103880 caused. The crucial difference between this and r103880 is that we now follow LLVM's little dance with the llvm.eh.exception and llvm.eh.selector calls, then use _Unwind_Resume_or_Rethrow to rethrow. llvm-svn: 103892
* Revert r103880 (thread-safe static initialization w/ exceptions),Douglas Gregor2010-05-163-44/+20
| | | | | | because it's causing strange linker errors. Unfixes PR7144. llvm-svn: 103890
* Minor twik to my last patch. (for radar 7986354).Fariborz Jahanian2010-05-161-2/+2
| | | | llvm-svn: 103889
* Fix API gen for objc_msgSend property of aggregate typesFariborz Jahanian2010-05-151-6/+10
| | | | | | in Objective-c++ mode. Fixes radar 7986354. llvm-svn: 103887
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-153-20/+44
| | | | | | | | __cxa_guard_abort along the exceptional edge into (in effect) a nested "try" that rethrows after aborting. Fixes PR7144 and the remaining Boost.ProgramOptions failures. llvm-svn: 103880
* Modify this comment per Doug's suggestion: we don't need to mangle protocols.John McCall2010-05-151-2/+2
| | | | llvm-svn: 103875
* When applying the named return value optimization, we still need toDouglas Gregor2010-05-151-2/+5
| | | | | | | destroy the variable along the exceptional edge; it's only during normal execution that we avoid destroying this variable. llvm-svn: 103872
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-159-10/+29
| | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 103870
* Implement a simple form of the C++ named return value optimization forDouglas Gregor2010-05-152-23/+42
| | | | | | | | | return statements. We perform NRVO only when all of the return statements in the function return the same variable. Fixes some link failures in Boost.Interprocess (which is relying on NRVO), and probably improves performance for some C++ applications. llvm-svn: 103867
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-1/+2
| | | | | | | | | | | | 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. llvm-svn: 103865
* Recognize when the named return value optimization applies in aDouglas Gregor2010-05-151-4/+6
| | | | | | | | | | "return" statement and mark the corresponding CXXConstructExpr as elidable. Teach CodeGen that eliding a temporary is different from eliding an object construction. This is just a baby step toward NRVO. llvm-svn: 103849
* C++/ABI/x86_64: Member pointers should be classified as INTEGER.Daniel Dunbar2010-05-151-0/+5
| | | | llvm-svn: 103843
* C++/ABI/i386: Member function pointers should be passed by value.Daniel Dunbar2010-05-151-2/+3
| | | | llvm-svn: 103842
* Emit an lvalue dynamic_cast even if the result is not used. AnotherDouglas Gregor2010-05-141-1/+15
| | | | | | part (or possibly all) of PR7132. llvm-svn: 103810
* When a failed dynamic_cast<T&> (which is an lvalue) results in aDouglas Gregor2010-05-141-3/+11
| | | | | | | | throw, it should use invoke when needed. The fixes the Boost.Statechrt failures that motivated PR7132, but there are a few side issues to tackle as well. llvm-svn: 103803
* Remove an unused function.Anders Carlsson2010-05-142-8/+0
| | | | llvm-svn: 103793
* Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.Anders Carlsson2010-05-143-25/+29
| | | | llvm-svn: 103792
* Fix thinko in yesterday's fix.Devang Patel2010-05-141-1/+1
| | | | | | Providing linkage name for function static variable confuses gdb, so don't do that. llvm-svn: 103779
* Make sure that value-initialized pointers to data members are initialized ↵Anders Carlsson2010-05-141-1/+1
| | | | | | correctly. llvm-svn: 103771
* C++/Darwin/x86: Teach IRgen it can pass reference types in registers.Daniel Dunbar2010-05-141-2/+2
| | | | llvm-svn: 103761
* Fix context in class static variable's debugging information entry.Devang Patel2010-05-131-4/+13
| | | | | | This fixes bunch of failures in gdb testsuite. llvm-svn: 103745
* Disable the available_externally optimization for inline virtualDouglas Gregor2010-05-131-11/+0
| | | | | | | | | | | | methods for which the key function is guaranteed to be in another translation unit. Unfortunately, this guarantee isn't the case when dealing with shared libraries that fail to export these virtual method definitions. I'm reopening PR6747 so we can consider this again at a later point in time. llvm-svn: 103741
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-135-56/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* If given location is invalid then use current location.Devang Patel2010-05-122-107/+58
| | | | | | | | | This fixes recent regressions reported by gdb testsuite. Tighter verification of debug info generated by FE found these regressions. Refactor code to extract line number and column number from SourceLocation. llvm-svn: 103678
* Use end location of DeclStmt to mark stop point. Devang Patel2010-05-121-1/+4
| | | | | | This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite. llvm-svn: 103533
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-112-8/+4
| | | | llvm-svn: 103517
* IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.Daniel Dunbar2010-05-111-0/+24
| | | | | | - Fixes PR7098. llvm-svn: 103514
* It's bad form to create VarDecl's without DeclContextsDouglas Gregor2010-05-111-1/+3
| | | | llvm-svn: 103484
OpenPOWER on IntegriCloud