summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop windows specific handling of equivalent destructors.Rafael Espindola2013-11-131-9/+0
| | | | | | | | | Now that the relevant tests use -mconstructor-aliases and the missing features have been implemented, we can just drop this. No functionality change. llvm-svn: 194595
* Avoid producing mismatched comdats.Rafael Espindola2013-11-121-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | The problem was that given template<typename T> struct foo { ~foo() {} }; template class foo<int>; We would produce a alias, creating a comdat with D0 and D1, since the symbols have to be weak. Another TU is not required to have a explicit template instantiation definition or an explict template instantiation declaration and for template<typename T> struct foo { ~foo() {} }; foo<int> a; we would produce a comdat with only one symbol in it. llvm-svn: 194520
* Fix pr17875.Rafael Espindola2013-11-111-3/+1
| | | | | | | | The assert this patch deletes was valid only when aliasing D2 to D1, not when looking at a base class. Since the assert was in the path where we had already decided to not produce an alias, just drop it. llvm-svn: 194411
* Don't emit an internal destructor that is identical to an external one.Rafael Espindola2013-11-091-13/+13
| | | | | | | It is not safe to emit alias to undefined (not supported by ELF or COFF), but it is safe to rauw when the alias would have been internal or linkonce_odr. llvm-svn: 194307
* Use rauw for all discardable aliases, not just linkonce_odr.Rafael Espindola2013-11-081-1/+1
| | | | llvm-svn: 194296
* If a linkonce_odr dtor/ctor is identical to another one, just rauw.Rafael Espindola2013-11-081-6/+7
| | | | | | | Unlike an alias a rauw is always safe, so we don't need to avoid this optimization when the replacement is not know to be available in every TU. llvm-svn: 194288
* Fix the -cxx-abi microsoft -mconstructor-aliases combination.Rafael Espindola2013-11-061-2/+2
| | | | | | | | | | On the microsoft ABI clang is producing one weak_odr and one linkonce_odr destructor, which is reasonable since only one is required. The fix is simply to move the assert past the special case treatment of linkonce_odr. llvm-svn: 194158
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-18/+21
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
* Fix vbtable indices when a class shares the vbptr with a non-virtual baseTimur Iskhodzhanov2013-11-051-2/+2
| | | | llvm-svn: 194082
* Revert "Produce direct calls instead of alias to linkonce_odr functions."Rafael Espindola2013-11-051-23/+18
| | | | | | | This reverts commit r194046. Debugging a bootstrap issue. llvm-svn: 194047
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-18/+23
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194046
* Use aliases for more constructors and destructors.Rafael Espindola2013-11-041-37/+48
| | | | | | | | | | | | | | | | With this patch we produce alias for cases like template<typename T> struct foobar { foobar() { } }; template struct foobar<void>; We just have to be careful to produce the same aliases in every TU because of comdats. llvm-svn: 194000
* Revert "Use aliases for more constructors and destructors."Rafael Espindola2013-10-101-6/+21
| | | | | | | | | This reverts commit r192300. The change itself looks correct, but it found issues on how we handle aliases in llvm. llvm-svn: 192353
* Use aliases for more constructors and destructors.Rafael Espindola2013-10-091-21/+6
| | | | | | | | | | | | | | | | With this patch we produce alias for cases like template<typename T> struct foobar { foobar() { } }; template struct foobar<void>; It is safe to use aliases to weak symbols, as long and the alias itself is also weak. llvm-svn: 192300
* Abstract out the emission of vtables, add basic support for vtable emission ↵Timur Iskhodzhanov2013-09-271-1/+1
| | | | | | | | when using -cxx-abi microsoft Reviewed at http://llvm-reviews.chandlerc.com/D1532 llvm-svn: 191523
* Abstract out virtual calls and virtual function prologue code generation; ↵Timur Iskhodzhanov2013-08-211-13/+2
| | | | | | implement them for -cxx-abi microsoft llvm-svn: 188870
* Emit the constructor for abstract classes when using -cxx-abi microsoft, ↵Timur Iskhodzhanov2013-08-041-14/+0
| | | | | | fixes PR16735 llvm-svn: 187709
* [ms-cxxabi] Emit linkonce complete dtors in TUs that need themReid Kleckner2013-07-221-20/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Peter Collingbourne's destructor patches. Prior to this change, clang was considering ?1 to be the complete destructor and the base destructor, which was wrong. This lead to crashes when clang tried to emit two LLVM functions with the same name. In this ABI, TUs with non-inline dtors might not emit a complete destructor. They are emitted as inline thunks in TUs that need them, and they always delegate to the base dtors of the complete class and its virtual bases. This change uses the DeferredDecls machinery to emit complete dtors as needed. Currently in clang try body destructors can catch exceptions thrown by virtual base destructors. In the Microsoft C++ ABI, clang may not have the destructor definition, in which case clang won't wrap the virtual virtual base destructor calls in a try-catch. Diagnosing this in user code is TODO. Finally, for classes that don't use virtual inheritance, MSVC always calls the base destructor (?1) directly. This is a useful code size optimization that avoids emitting lots of extra thunks or aliases. Implementing it also means our existing tests continue to pass, and is consistent with MSVC's output. We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but it will require further testing. Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1066 llvm-svn: 186828
* Simplify the CodeGenFunction::Build*Virtual*Call family of functionsTimur Iskhodzhanov2013-07-191-60/+35
| | | | llvm-svn: 186657
* [ms-cxxabi] Thread GlobalDecls through to CodeGenModule::getFunctionLinkage.Peter Collingbourne2013-06-051-5/+4
| | | | | | | | This is so that we can give destructor variants different linkage later. Differential Revision: http://llvm-reviews.chandlerc.com/D819 llvm-svn: 183324
* Better support for constructors with -cxx-abi microsoft, partly fixes PR12784Timur Iskhodzhanov2013-02-271-2/+4
| | | | llvm-svn: 176186
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer2012-07-041-1/+1
| | | | | | | | instead. No functionality change. llvm-svn: 159719
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-1/+1
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-16/+13
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* Move all vtable layout data into new VTableLayout classPeter Collingbourne2011-09-261-4/+4
| | | | llvm-svn: 140506
* Move vtable component accessors to VTableContextPeter Collingbourne2011-09-261-2/+4
| | | | llvm-svn: 140504
* Create a VTableContext class and start moving CodeGenVTables methods to itPeter Collingbourne2011-09-261-4/+4
| | | | llvm-svn: 140502
* Disable the optimization that skips emission of complete, non-virtualDouglas Gregor2011-07-261-5/+1
| | | | | | | | | destructors of abstract classes. It's undefined behavior to actually call the destructor (e.g., via delete), but the presence of code that calls this destructor doesn't make the program ill-formed. Fixes <rdar://problem/9819242>. llvm-svn: 136180
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-3/+3
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-8/+8
| | | | llvm-svn: 135370
* Revert r131434, my commit disabling the complete-object constructorJohn McCall2011-05-171-2/+1
| | | | | | | optimization for abstract classes; there was a misunderstanding, and it turns out that there are no kexts which rely on this. llvm-svn: 131489
* Emit complete-object constructors for abstract classes in kext mode forJohn McCall2011-05-161-1/+2
| | | | | | reasons that honestly really, really need to be looked into. llvm-svn: 131434
* When emitting the destructor for a class with a vtable, if we can determineAnders Carlsson2011-05-141-12/+1
| | | | | | | | | | that the destructor body is trivial and that all member variables also have either trivial destructors or trivial destructor bodies, we don't need to initialize the vtable pointers since no virtual member functions will be called on the destructor. Fixes PR9181. llvm-svn: 131368
* Don't emit complete constructors for abstract classes. Also, don't emitAnders Carlsson2011-05-081-2/+9
| | | | | | | complete destructors for abstract classes unless the destructor is virtual and thus needs to be in the vtable. llvm-svn: 131068
* Convert the BaseOffset member of BaseSubobject to CharUnits from bits. NoKen Dyck2011-03-241-2/+2
| | | | | | change in functionality intended. llvm-svn: 128190
* Fix three of the four places where I left breadcrumbs to avoid unnecessaryJohn McCall2011-03-091-48/+53
| | | | | | recomputation. llvm-svn: 127322
* Use the "undergoes default argument promotion" bit on parameters toJohn McCall2011-03-091-2/+8
| | | | | | | | | | 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. llvm-svn: 127314
* Look through array types when deciding whether a field requires non-trivialJohn McCall2011-02-131-5/+4
| | | | | | destruction in the destructor-aliases logic. Fixes PR 9197. llvm-svn: 125447
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-4/+4
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* Re-land r124768, with a fix for PR9130.Anders Carlsson2011-02-051-2/+4
| | | | | | We now emit everything except unused implicit virtual member functions when building the vtable. llvm-svn: 124935
* Clean up of -fapple-kext abi code. No change otherwise.Fariborz Jahanian2011-02-031-7/+5
| | | | llvm-svn: 124807
* Revert 124768.Rafael Espindola2011-02-031-4/+2
| | | | | | | This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. llvm-svn: 124780
* Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson2011-02-031-2/+4
| | | | | | | | | | | is not defined in the current translation unit. Doing so lead to compile errors such as PR9114. Instead, when CodeGen is building the vtable, don't try to emit a definition for functions that aren't marked used in the current translation unit. Fixes PR9114. llvm-svn: 124768
* -fapple-kext support for indirect call to virtuals dtors - wip.Fariborz Jahanian2011-02-011-0/+42
| | | | llvm-svn: 124701
* More work to support -fapple-kext regarding Fariborz Jahanian2011-01-281-1/+3
| | | | | | | indirect vf calls and addition of extra entry at bottom of vtbls. llvm-svn: 124507
* apple kext abi requires all vf calls, including qualifiedFariborz Jahanian2011-01-201-0/+29
| | | | | | vf calls, be made indirect. This patch is towards that goal. llvm-svn: 123922
* Move name mangling support from CodeGen to AST. In thePeter Collingbourne2011-01-131-1/+1
| | | | | | | | | | | | | | 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. llvm-svn: 123386
* BuildVirtualCall doesn't need to take a reference to a pointer.Anders Carlsson2010-11-281-1/+1
| | | | llvm-svn: 120252
* Move CGCXXABI functions to CGCXXABI.cppAnders Carlsson2010-11-281-157/+0
| | | | llvm-svn: 120250
OpenPOWER on IntegriCloud