aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
AgeCommit message (Collapse)Author
2013-02-27Better support for constructors with -cxx-abi microsoft, partly fixes PR12784Timur Iskhodzhanov
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176186 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-04Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used ↵Benjamin Kramer
instead. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159719 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie
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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17Whether an argument is required (in contrast with being anJohn McCall
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150788 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26Move all vtable layout data into new VTableLayout classPeter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26Move vtable component accessors to VTableContextPeter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-26Create a VTableContext class and start moving CodeGenVTables methods to itPeter Collingbourne
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-26Disable the optimization that skips emission of complete, non-virtualDouglas Gregor
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136180 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18de-constify llvm::Type, patch by David Blaikie!Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135370 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17Revert r131434, my commit disabling the complete-object constructorJohn McCall
optimization for abstract classes; there was a misunderstanding, and it turns out that there are no kexts which rely on this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131489 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16Emit complete-object constructors for abstract classes in kext mode forJohn McCall
reasons that honestly really, really need to be looked into. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131434 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14When emitting the destructor for a class with a vtable, if we can determineAnders Carlsson
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-08Don't emit complete constructors for abstract classes. Also, don't emitAnders Carlsson
complete destructors for abstract classes unless the destructor is virtual and thus needs to be in the vtable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131068 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-24Convert the BaseOffset member of BaseSubobject to CharUnits from bits. NoKen Dyck
change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09Fix three of the four places where I left breadcrumbs to avoid unnecessaryJohn McCall
recomputation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127322 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09Use the "undergoes default argument promotion" bit on parameters toJohn McCall
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13Look through array types when deciding whether a field requires non-trivialJohn McCall
destruction in the destructor-aliases logic. Fixes PR 9197. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125447 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall
Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125085 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05Re-land r124768, with a fix for PR9130.Anders Carlsson
We now emit everything except unused implicit virtual member functions when building the vtable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124935 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03Clean up of -fapple-kext abi code. No change otherwise.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03Revert 124768.Rafael Espindola
This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124768 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-01-fapple-kext support for indirect call to virtuals dtors - wip.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124701 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28More work to support -fapple-kext regarding Fariborz Jahanian
indirect vf calls and addition of extra entry at bottom of vtbls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124507 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-20apple kext abi requires all vf calls, including qualifiedFariborz Jahanian
vf calls, be made indirect. This patch is towards that goal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123922 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13Move name mangling support from CodeGen to AST. In thePeter Collingbourne
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28BuildVirtualCall doesn't need to take a reference to a pointer.Anders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28Move CGCXXABI functions to CGCXXABI.cppAnders Carlsson
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-06Simplify the logic for emitting guard variables for template staticJohn McCall
data members by delaying the emission of the initializer until after linkage and visibility have been set on the global. Also, don't emit a guard unless the variable actually ends up with vague linkage, and don't use thread-safe statics in any case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31Rename getBaseClassOffset to getBaseClassOffsetInBits and introduce a ↵Anders Carlsson
getBaseClassOffset which returns the offset in CharUnits. Do the same thing for getVBaseClassOffset. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26Factor out the code for emitting code to load vtable pointer membersDan Gohman
so that it's done in one place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22Substantially revise how clang computes the visibility of a declaration toJohn McCall
more closely parallel the computation of linkage. This gets us to a state much closer to what gcc emits, modulo bugs, which will undoubtedly arise in abundance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117147 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-04Fix filename in header comment.Devang Patel
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115561 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08Implement ARM static local initialization guards, which are more compact thanJohn McCall
Itanium guards and use a slightly different compiled-in API. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02Abstract IR generation of array cookies into the C++ ABI class andJohn McCall
implement ARM array cookies. Also fix a few unfortunate bugs: - throwing dtors in deletes prevented the allocation from being deleted - adding the cookie to the new[] size was not being considered for overflow (and, more seriously, was screwing up the earlier checks) - deleting an array via a pointer to array of class type was not causing any destructors to be run and was passing the unadjusted pointer to the deallocator - lots of address-space problems, in case anyone wants to support free store in a variant address space :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112814 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31Amusingly, I missed this point of abstraction in all my earlierJohn McCall
member-pointer refactoring: dereferencing a member data pointer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112640 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31Teach IR generation to return 'this' from constructors and destructorsJohn McCall
under the ARM ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112588 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Abstract out everything having to do with member pointers into the ABIJohn McCall
class; they should just be completely opaque throughout IR gen now, although I haven't really audited that. Fix a bug apparently inherited from gcc-4.2 where we failed to null-check member data pointers when performing derived-to-base or base-to-derived conversions on them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111789 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Go back to asking CodeGenTypes whether a type is zero-initializable.John McCall
Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111786 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Experiment with using first-class aggregates to represent member functionJohn McCall
pointers. I find the resulting code to be substantially cleaner, and it makes it very easy to use the same APIs for data member pointers (which I have conscientiously avoided here), and it avoids a plethora of potential inefficiencies due to excessive memory copying, but we'll have to see if it actually works. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111776 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Extract member function pointer comparison and null comparison intoJohn McCall
the ABI code. Implement correct semantics for these on ARM. I believe this completes the implementation of member function pointers on ARM. I think I'm going to switch member function pointers over to be non-aggregates while I have all this in mind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111774 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Abstract out member-pointer creation. I'm really unhappy about the currentJohn McCall
duplication between the constant and non-constant paths in all of this. Implement ARM ABI semantics for member pointer constants and conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111772 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Abstract more member-pointerness out.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Abstract out member-pointer conversions.John McCall
Pretty much everything having to do with member pointers is ABI-specific. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22Extract calls to method pointers out as an ABI routine.John McCall
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111752 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Implement support for member pointers under the Microsoft C++ ABI in theCharles Davis
AST library. This also adds infrastructure for supporting multiple C++ ABIs in the AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111117 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-07Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis
of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107768 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01Remove unnecessary ASTContext parameter fromDouglas Gregor
CXXRecordDecl::getDestructor(); no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107394 91177308-0d34-0410-b5e6-96231b3b80d8