summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle constructors and destructors a bit more uniformly in CodeGen.Rafael Espindola2014-09-081-31/+33
| | | | | | | | | There were code paths that are duplicated for constructors and destructors just because we have both CXXCtorType and CXXDtorsTypes. This patch introduces an unified enum and reduces code deplication a bit. llvm-svn: 217383
* Update for llvm API change.Rafael Espindola2014-06-031-9/+6
| | | | | | Aliases in llvm now hold an arbitrary expression. llvm-svn: 210063
* Start adding support for dllimport/dllexport on classes (PR11170)Hans Wennborg2014-05-301-0/+4
| | | | | | | | | | | | | | | | This implements the central part of support for dllimport/dllexport on classes: allowing the attribute on class declarations, inheriting it to class members, and forcing emission of exported members. It's based on Nico Rieck's patch from http://reviews.llvm.org/D1099. This patch doesn't propagate dllexport to bases that are template specializations, which is an interesting problem. It also doesn't look at the rules when redeclaring classes with different attributes, I'd like to do that separately. Differential Revision: http://reviews.llvm.org/D3877 llvm-svn: 209908
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-3/+3
| | | | llvm-svn: 209272
* Update for llvm api change.Rafael Espindola2014-05-171-2/+2
| | | | llvm-svn: 209077
* Update for llvm api change.Rafael Espindola2014-05-171-2/+2
| | | | llvm-svn: 209074
* Update for llvm api change.Rafael Espindola2014-05-161-6/+9
| | | | | | | | | | Now that llvm cannot represent alias cycles, we have to diagnose erros just before trying to close the cycle. This degrades the errors a bit. The real solution is what it was before: if we want to provide good errors for these cases, we have to be able to find a clang level decl given a mangled name and produce the error from Sema. llvm-svn: 209008
* Update for llvm API change.Rafael Espindola2014-05-161-2/+2
| | | | llvm-svn: 208984
* Use auto to avoid duplicating the type.Rafael Espindola2014-05-091-9/+9
| | | | llvm-svn: 208374
* Cleanup setFunctionDefinitionAttributes.Rafael Espindola2014-05-081-2/+2
| | | | | | Use more specific type, update comments and name style. llvm-svn: 208328
* [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with ↵Aaron Ballman2014-03-131-4/+3
| | | | | | iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203803
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-2/+1
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* Don't produce an alias between destructors with different calling conventions.Rafael Espindola2014-03-051-0/+6
| | | | | | Fixes pr19007. llvm-svn: 203007
* [ms-abi] Always generate complete constructors in the Microsoft C++ ABIReid Kleckner2014-01-131-5/+7
| | | | | | | | Fixes PR18435, where we generated a base ctor instead of a complete ctor, and so failed to construct virtual bases when constructing the complete object. llvm-svn: 199160
* Avoid adding some decls to DeferredDeclsToEmit.Rafael Espindola2013-12-091-8/+12
| | | | | | | | Before this patch GetOrCreateLLVMFunction would add a decl to DeferredDeclsToEmit even when it was being called by the function trying to emit that decl. llvm-svn: 196753
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-4/+4
| | | | llvm-svn: 196510
* Adjust r194296 to not apply the alias replacement for externallyJoerg Sonnenberger2013-11-221-1/+8
| | | | | | | | available always-inline functions. This breaks libc++'s locale implementation. Code generation for this case should be fixed, but this is a stop gap fix for clang 3.4. llvm-svn: 195501
* Don't use alias from derived dtor to base dtor at -O0.Rafael Espindola2013-11-131-0/+5
| | | | | | | | | | This patch disables aliasing (and rauw) of derived dtors to base dtors at -O0. This optimization can have a negative impact on the debug quality. This was a latent bug for some time with local classes, but got noticed when it was generalized and broke gdb's destrprint.exp. llvm-svn: 194618
* 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
OpenPOWER on IntegriCloud