summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
* Give this test a triple.John McCall2010-05-271-1/+1
| | | | llvm-svn: 104798
* When deciding whether a deferred declaration has already been emitted,John McCall2010-05-271-1/+64
| | | | | | | aliases count as definitions regardless of whether their target has been emitted yet. Fixes PR 7142. llvm-svn: 104796
* Correctly pass aggregates by reference when emitting thunks.John McCall2010-05-261-0/+18
| | | | llvm-svn: 104778
* Patch to fix a irgen crash accessing an initialized local staticFariborz Jahanian2010-05-261-0/+12
| | | | | | variable in a local function. Fixes pr7101. llvm-svn: 104743
* Be sure to use the standard substitutions when mangling the names ofDouglas Gregor2010-05-261-3/+41
| | | | | | vtables, VTTs, and construction vtables. Fixes PR7201. llvm-svn: 104675
* If a function definition has any sort of weak linkage, its static localJohn McCall2010-05-251-2/+13
| | | | | | | | | | | | variables should have that linkage. Otherwise, its static local variables should have internal linkage. To avoid computing this excessively, set a function's linkage before we emit code for it. Previously we were assigning weak linkage to the static variables of static inline functions in C++, with predictably terrible results. This fixes that and also gives better linkage than 'weak' when merging is required. llvm-svn: 104581
* IRgen/C++: When mark vtables used, make sure to still append to the ↵Daniel Dunbar2010-05-251-1/+15
| | | | | | | | | VTableUse array if we promote a vtable from being just used to having its definition required. This ensures that we properly inform the consumer about whether the vtable is required or not, previously we could fail to do so when the vtable was in the VTableUses array before the decl which marked it as required. - I think this can be cleaned up, since this means we may notify the consumer about the vtable twice, but I didn't see an easy fix for this without more substantial refactoring. - Doug, please review! llvm-svn: 104577
* Add a comment for r104472.Benjamin Kramer2010-05-231-1/+1
| | | | llvm-svn: 104473
* PR5863: Don't erase unreachable BBs which have an associated cleanup size.Benjamin Kramer2010-05-231-0/+13
| | | | | | | This works around a crash where malloc reused the memory of an erased BB for a new BB leaving old cleanup information pointing at the new block. llvm-svn: 104472
* Really fix PR7139. There was one boost test that we still failed, and my ↵Anders Carlsson2010-05-221-0/+6
| | | | | | first fix broke self-host. llvm-svn: 104447
* Re-land the fix for PR7139.Anders Carlsson2010-05-221-1/+28
| | | | llvm-svn: 104446
* Implement support for variable length arrays in C++. VLAs are limitedDouglas Gregor2010-05-221-0/+27
| | | | | | | | | | | | | in several important ways: - VLAs of non-POD types are not permitted. - VLAs cannot be used in conjunction with C++ templates. These restrictions are intended to keep VLAs out of the parts of the C++ type system where they cause the most trouble. Fixes PR5678 and <rdar://problem/8013618>. llvm-svn: 104443
* Improve our handling of reference binding for subobjects ofDouglas Gregor2010-05-221-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | temporaries. There are actually several interrelated fixes here: - When converting an object to a base class, it's only an lvalue cast when the original object was an lvalue and we aren't casting pointer-to-derived to pointer-to-base. Previously, we were misclassifying derived-to-base casts of class rvalues as lvalues, causing various oddities (including problems with reference binding not extending the lifetimes of some temporaries). - Teach the code for emitting a reference binding how to look through no-op casts and parentheses directly, since Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make sure that we properly look through multiple levels of indirection from the temporary object, but destroy the actual temporary object; this fixes the reference-binding issue mentioned above. - Teach Objective-C message sends to bind the result as a temporary when needed. This is actually John's change, but it triggered the reference-binding problem above, so it's included here. Now John can actually test his return-slot improvements. llvm-svn: 104434
* Unbreak self-host.Anders Carlsson2010-05-211-28/+1
| | | | llvm-svn: 104390
* Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle ↵Anders Carlsson2010-05-211-1/+28
| | | | | | setting null data member pointers correctly. Fixes PR7139. llvm-svn: 104387
* When generating the call arguments in a thunk to call the thunkee, doDouglas Gregor2010-05-211-0/+45
| | | | | | | | not make copies non-POD arguments or arguments passed by reference: just copy the pointers directly. This eliminates another source of the dreaded memcpy-of-non-PODs. Fixes PR7188. llvm-svn: 104327
* When emitting an lvalue for an anonymous struct or union member duringJohn McCall2010-05-211-0/+26
| | | | | | | class initialization, drill down through an arbitrary number of anonymous records. llvm-svn: 104310
* Be sure to apply initializers to members of anonymous structs and unionsJohn McCall2010-05-201-0/+18
| | | | | | | | recursively, e.g. so that members of anonymous unions inside anonymous structs still get initialized. Also generate default constructor calls for anonymous struct members when necessary. llvm-svn: 104292
* Rework our handling of binding a reference to a temporaryDouglas Gregor2010-05-201-1/+54
| | | | | | | | | | | | | | | | | | | | 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-4/+45
| | | | | | | | | 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
* Correctly initialize bases with member pointers. This should fix PR6441 but ↵Anders Carlsson2010-05-181-0/+16
| | | | | | that test case is a bit weird and I'd like to investigate further before closing that bug. llvm-svn: 104025
* C++/Darwin/i386 ABI: Fix some problems with empty record handling.Daniel Dunbar2010-05-171-0/+18
| | | | | | | | - 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-171-2/+21
| | | | | | | function does not return. Thanks to Eli for pointing out this corner case. llvm-svn: 103941
* When constant folding reference variables with an initializer to theChandler Carruth2010-05-161-0/+13
| | | | | | | | initializer, don't fold paramters. Their initializers are just default arguments which can be overridden. This fixes some spectacular regressions due to more things making it into the constant folding. llvm-svn: 103904
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-161-0/+26
| | | | | | | | | | | | | __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-161-24/+0
| | | | | | because it's causing strange linker errors. Unfixes PR7144. llvm-svn: 103890
* When initializing thread-safe statics, put the call toDouglas Gregor2010-05-151-0/+24
| | | | | | | | __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
* Attempt to satisfy Release-Asserts buildDouglas Gregor2010-05-151-3/+0
| | | | llvm-svn: 103879
* When applying the named return value optimization, we still need toDouglas Gregor2010-05-151-0/+13
| | | | | | | destroy the variable along the exceptional edge; it's only during normal execution that we avoid destroying this variable. llvm-svn: 103872
* Implement a simple form of the C++ named return value optimization forDouglas Gregor2010-05-151-0/+55
| | | | | | | | | 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
* C++/ABI/x86_64: Member pointers should be classified as INTEGER.Daniel Dunbar2010-05-151-0/+8
| | | | llvm-svn: 103843
* C++/ABI/i386: Member function pointers should be passed by value.Daniel Dunbar2010-05-151-0/+9
| | | | llvm-svn: 103842
* Tweak test so that it does not require <typeinfo>Douglas Gregor2010-05-141-5/+2
| | | | llvm-svn: 103819
* Emit an lvalue dynamic_cast even if the result is not used. AnotherDouglas Gregor2010-05-141-1/+1
| | | | | | part (or possibly all) of PR7132. llvm-svn: 103810
* When a failed dynamic_cast<T&> (which is an lvalue) results in aDouglas Gregor2010-05-142-5/+15
| | | | | | | | 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
* Make sure that value-initialized pointers to data members are initialized ↵Anders Carlsson2010-05-141-0/+17
| | | | | | correctly. llvm-svn: 103771
* A vtable is used if the key function is defined... even if that keyDouglas Gregor2010-05-141-1/+10
| | | | | | | function's definition is an out-of-class definition marked "inline". Fixes an assertion in WebKit. llvm-svn: 103763
* XFAIL a test on Win32.Daniel Dunbar2010-05-141-0/+4
| | | | llvm-svn: 103762
* C++/Darwin/x86: Teach IRgen it can pass reference types in registers.Daniel Dunbar2010-05-141-0/+4
| | | | llvm-svn: 103761
* 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-137-882/+938
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.Daniel Dunbar2010-05-111-1/+33
| | | | | | - Fixes PR7098. llvm-svn: 103514
* When instantiating statements that involve conditions (if, while, do,Douglas Gregor2010-05-081-0/+79
| | | | | | | | | | | | | for, and switch), be careful to construct the full expressions as soon as we perform template instantation, so we don't either forget to call temporary destructors or destroy temporaries at the wrong time. This is the template-instantiation analogue to r103187, during which I hadn't realized that the issue would affect the handling of these constructs differently inside and outside of templates. Fixes a regression in Boost.Function. llvm-svn: 103357
* Fix test for Release-Asserts buildDouglas Gregor2010-05-081-12/+12
| | | | llvm-svn: 103337
* Do not give implicitly-defined virtual members functionsDouglas Gregor2010-05-061-0/+20
| | | | | | | | | | | | | available_externally linkage, since they may not have been given a strong definition in another translation unit. Without this patch, the following test case fails to link with a GCC-compiled libstdc++: #include <sstream> int main() { std::basic_stringbuf<char> bs; } Fixes the last problem with the Boost.IO library. llvm-svn: 103208
* The global variable for the VTT might not have external linkage; allowDouglas Gregor2010-05-061-1/+9
| | | | | | | us to find local variables, too. Fixes the last remaining Boost.Rational failure. llvm-svn: 103203
* Rework our handling of temporary objects within the conditions ofDouglas Gregor2010-05-061-0/+63
| | | | | | | | | | | | | | | | | | | if/switch/while/do/for statements. Previously, we would end up either: (1) Forgetting to destroy temporaries created in the condition (!), (2) Destroying the temporaries created in the condition *before* converting the condition to a boolean value (or, in the case of a switch statement, to an integral or enumeral value), or (3) In a for statement, destroying the condition's temporaries at the end of the increment expression (!). We now destroy temporaries in conditions at the right times. This required some tweaking of the Parse/Sema interaction, since the parser was building full expressions too early in many places. Fixes PR7067. llvm-svn: 103187
* simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode,Chris Lattner2010-05-061-3/+27
| | | | | | fixing PR7063. llvm-svn: 103171
* Pass the globaldecl into GetOrCreateLLVMFunction so that llvmChris Lattner2010-05-051-1/+30
| | | | | | | | | function attributes like byval get applied to the function definition. This fixes PR7058 and makes i386 llvm/clang bootstrap pass all the same tests as x86-64 bootstrap for me (the llvmc tests still fail in both). llvm-svn: 103131
* When we emit a non-constant initializer for a global variable ofDouglas Gregor2010-05-051-0/+28
| | | | | | | | reference type, make sure that the initializer we build is the of the appropriate type for the *reference*, not for the thing that it refers to. Fixes PR7050. llvm-svn: 103115
OpenPOWER on IntegriCloud