summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/MicrosoftCXXABI.cpp
Commit message (Collapse)AuthorAgeFilesLines
* IRGen: When performing CFI checks, load vtable pointer from vbase when ↵Peter Collingbourne2017-12-131-7/+22
| | | | | | | | | | | | | | necessary. Under the Microsoft ABI, it is possible for an object not to have a virtual table pointer of its own if all of its virtual functions were introduced by virtual bases. In that case, we need to load the vtable pointer from one of the virtual bases and perform the type check using its type. Differential Revision: https://reviews.llvm.org/D41036 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320638 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Apply adjustments after storing 'this'Reid Kleckner2017-11-161-37/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MS ABI convention is that the 'this' pointer on entry is the address of the vfptr that was used to make the virtual method call. In other words, the pointer on entry always points to the base subobject that introduced the virtual method. Consider this hierarchy: struct A { virtual void f() = 0; }; struct B { virtual void g() = 0; }; struct C : A, B { void f() override; void g() override; }; On entry to C::g, [ER]CX will contain the address of C's B subobject, and C::g will have to subtract sizeof(A) to recover a pointer to C. Before this change, we applied this adjustment in the prologue and stored the new value into the "this" local variable alloca used for debug info. However, MSVC does not do this, presumably because it is often profitable to fold the adjustment into later field accesses. This creates a problem, because the debugger expects the variable to be unadjusted. Unfortunately, CodeView doesn't have anything like DWARF expressions for computing variables that aren't in the program anymore, so we have to declare 'this' to be the unadjusted value if we want the debugger to see the right value. This has the side benefit that, in optimized builds, the 'this' pointer will usually be available on function entry because it doesn't require any adjustment. Reviewers: hans Subscribers: aprantl, cfe-commits Differential Revision: https://reviews.llvm.org/D40109 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318440 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Don't bail on replacing dllimport vbase dtors with base dtorsReid Kleckner2017-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | Fix PR32990 by effectively reverting r283063 and solving it a different way. We want to limit the hack to not replace equivalent available_externally dtors specifically to libc++, which uses always_inline. It seems certain versions of libc++ do not provide all the symbols that an explicit template instantiation is expected to provide. If we get to the code that forms a real alias, only *then* check if this is available_externally, and do that by asking a better question, which is "is this a declaration for the linker?", because *that's* what means we can't form an alias to it. As a follow-on simplification, remove the InEveryTU parameter. Its last use guarded this code for forming aliases, but we should never form aliases to declarations, regardless of what we know about every TU. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315656 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-161-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. Based on a patch by Vassil Vassilev, which was based on a patch by Bernd Schmidt, which was based on a patch by Reid Kleckner! This is a re-commit of r310401, which was reverted in r310464 due to ARM failures (which should now be fixed). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310983 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "PR19668, PR23034: Fix handling of move constructors and deleted copy ↵Diana Picus2017-08-091-25/+27
| | | | | | | | | constructors when deciding whether classes should be passed indirectly." This reverts commit r310401 because it seems to have broken some ARM bot(s). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310464 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19668, PR23034: Fix handling of move constructors and deleted copyRichard Smith2017-08-081-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | constructors when deciding whether classes should be passed indirectly. This fixes ABI differences between Clang and GCC: * Previously, Clang ignored the move constructor when making this determination. It now takes the move constructor into account, per https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may seem recent, but the ABI change was agreed on the Itanium C++ ABI list a long time ago). * Previously, Clang's behavior when the copy constructor was deleted was unstable -- depending on whether the lazy declaration of the copy constructor had been triggered, you might get different behavior. We now eagerly declare the copy constructor whenever its deletedness is unclear, and ignore deleted copy/move constructors when looking for a trivial such constructor. This also fixes an ABI difference between Clang and MSVC: * If the copy constructor would be implicitly deleted (but has not been lazily declared yet), for instance because the class has an rvalue reference member, we would pass it directly. We now pass such a class indirectly, matching MSVC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310401 91177308-0d34-0410-b5e6-96231b3b80d8
* Add branch weights to branches for static initializers.Richard Smith2017-07-261-4/+6
| | | | | | | | | | | | | | | | | | | | The initializer for a static local variable cannot be hot, because it runs at most once per program. That's not quite the same thing as having a low branch probability, but under the assumption that the function is invoked many times, modeling this as a branch probability seems reasonable. For TLS variables, the situation is less clear, since the initialization side of the branch can run multiple times in a program execution, but we still expect initialization to be rare relative to non-initialization uses. It would seem worthwhile to add a PGO counter along this path to make this estimation more accurate in future. For globals with guarded initialization, we don't yet apply any branch weights. Due to our use of COMDATs, the guard will be reached exactly once per DSO, but we have no idea how many DSOs will define the variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309195 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules ts] Basic for module linkage.Richard Smith2017-07-071-0/+2
| | | | | | | | | | | In addition to the formal linkage rules, the Modules TS includes cases where internal-linkage symbols within a module interface unit can be referenced from outside the module via exported inline functions / templates. We give such declarations "module-internal linkage", which is formally internal linkage, but results in an externally-visible symbol. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307434 91177308-0d34-0410-b5e6-96231b3b80d8
* [DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer.Alexey Bataev2017-06-091-14/+15
| | | | | | | | | | | | | | | | | Summary: If the first parameter of the function is the ImplicitParamDecl, codegen automatically marks it as an implicit argument with `this` or `self` pointer. Added internal kind of the ImplicitParamDecl to separate 'this', 'self', 'vtt' and other implicit parameters from other kind of parameters. Reviewers: rjmccall, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33735 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305075 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit available_externally vtables opportunisticallyPiotr Padlewski2017-06-011-0/+3
| | | | | | | | | | | | | | Summary: We can emit vtable definition having inline function if they are all emitted. Reviewers: rjmccall, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33437 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304394 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang for LLVM rename AttributeSet -> AttributeListReid Kleckner2017-03-211-12/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298394 91177308-0d34-0410-b5e6-96231b3b80d8
* Promote ConstantInitBuilder to be a public CodeGen API; it'sJohn McCall2017-03-021-1/+1
| | | | | | a generally useful utility for other frontends. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296806 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Fix ExtParameterInfo bugs in C++ CodeGen code.George Burgess IV2017-02-231-1/+1
| | | | | | | | | | | | | | | | | This patch makes use of the prefix/suffix ABI argument distinction that was introduced in r295870, so that we now emit ExtParameterInfo at the correct offset for member calls that have added ABI arguments. I don't see a good way to test the generated param info, since we don't actually seem to use it in CGFunctionInfo outside of Swift. Any suggestions/thoughts for how to better test this are welcome. :) This patch also fixes a small bug with inheriting constructors: if we decide not to pass args into an base class ctor, we would still generate ExtParameterInfo as though we did. The added test-case is for that behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296024 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Note where we add ABI-specific args in ctors. NFC.George Burgess IV2017-02-221-23/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Meta: The ultimate goal is to teach ExtParameterInfo about pass_object_size attributes. This is necessary for that, since our ExtParameterInfo is a bit buggy in C++. I plan to actually make use of this Prefix/Suffix info in the near future, but I like small single-purpose changes. Especially when those changes are hard to actually test... At the moment, some of our C++-specific CodeGen pretends that ABIs can only add arguments to the beginning of a function call. This isn't quite correct: args can be appended to the end, as well. It hasn't mattered much until now, since we seem to only use this "number of arguments added" data when calculating the ExtParameterInfo to use when making a CGFunctionInfo. Said ExtParameterInfo is currently only used for ParameterABIs (Swift) and ns_consumed (ObjC). So, this patch allows ABIs to indicate whether args they added were at the beginning or end of an argument list. We can use this information to emit ExtParameterInfos more correctly, though like said, that bit is coming soon. No tests since this is theoretically a nop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295870 91177308-0d34-0410-b5e6-96231b3b80d8
* Move vtable type metadata emission behind a cc1-level flag.Peter Collingbourne2017-01-181-1/+1
| | | | | | | | | | | | | In ThinLTO mode, type metadata will require the module to be written as a multi-module bitcode file, which is currently incompatible with the Darwin linker. It is also useful to be able to enable or disable multi-module bitcode for testing purposes. This introduces a cc1-level flag, -f{,no-}lto-unit, which is used by the driver to enable multi-module bitcode on all but Darwin+ThinLTO, and can also be used to enable/disable the feature manually. Differential Revision: https://reviews.llvm.org/D28877 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292448 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: update comment about RTTI fieldSaleem Abdulrasool2017-01-011-1/+1
| | | | | | | | | | The MS ABI RTTI has a reserved field which is used as a cache for the demangled name. It must be zero-initialized, which is used as a hint by the runtime to say that the cache has not been populated. Since this field is populated at runtime, the RTTI structures must be placed in the .data section rather than .rdata. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290799 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: fix runtime function dll storageSaleem Abdulrasool2016-12-151-4/+8
| | | | | | | | | | | | | | | | | Properly attribute DLL storage to runtime functions. When generating the runtime function, scan for an existing declaration which may provide an explicit declaration (local storage) or a DLL import or export storage from the user. Honour that if available. Otherwise, if building with a local visibility of the public or standard namespaces (-flto-visibility-public-std), give the symbols local storage (it indicates a /MT[d] link, so static runtime). Otherwise, assume that the link is dynamic, and give the runtime function dllimport storage. This allows for implementations to get the correct storage as long as they are properly declared, the user to override the import storage, and in case no explicit storage is given, use of the import storage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289776 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: New vtable group representation: struct of vtable arrays.Peter Collingbourne2016-12-131-9/+7
| | | | | | | | | In a future change, this representation will allow us to use the new inrange annotation on getelementptr to allow the optimizer to split vtable groups. Differential Revision: https://reviews.llvm.org/D22296 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289584 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS-ABI]V-base dtor called more than needed when throw happens in v-base ↵Erich Keane2016-12-071-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ctor in window. Need add "complete object flag" check in eh cleanup code. The problem only happen on window ( A MS-ABI issuer ) The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor. The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup. clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor. But that part is missing for cleanup code. To fix this add similar code as v-base init to cleanup code, same algorithm. 1> Add new routine: EmitDtorCompleteObjectHandler With corresponding to EmitCtorCompleteObjectHandler 2> In the EmitDestructorCal Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor. Just add check for "complete object flag" before call to v-base dtor. Without my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 cleanupret from %13 unwind to caller, !dbg !66 with my change: ehcleanup: ; preds = %ctor.skip_vbases %13 = cleanuppad within none [], !dbg !66 %14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66 %15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66 %16 = bitcast i8* %15 to %struct.class_2*, !dbg !66 %is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66 br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d bg !66 Dtor.dtor_vbase: ; preds = %ehcleanup call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token %13) ], !dbg !66 br label %Dtor.skip_vbase, !dbg !66 Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup cleanupret from %13 unwind to caller, !dbg !66 Please let me know you need more info. Patch by Jennifer Yu. Differential Revision: https://reviews.llvm.org/D27358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288869 91177308-0d34-0410-b5e6-96231b3b80d8
* Make CGVTables use ConstantInitBuilder. NFC.John McCall2016-11-281-3/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288081 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove C++ default arg side table for MS ABI ctor closuresReid Kleckner2016-11-231-5/+5
| | | | | | | | | | | | | | | | | | | Summary: We don't need a side table in ASTContext to hold CXXDefaultArgExprs. The important part of building the CXXDefaultArgExprs was to ODR use the default argument expressions, not to make AST nodes. Refactor the code to only check the default argument, and remove the side table in ASTContext which wasn't being serialized. Fixes PR31121 Reviewers: thakis, rsmith, majnemer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27007 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287774 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema, CodeGen: Ensure that an implicit copy ctor is available more often ↵Peter Collingbourne2016-11-221-9/+16
| | | | | | | | | | | | | | | | under the Microsoft C++ ABI. This is needed because whether the constructor is deleted can control whether we pass structs by value directly. To fix this properly we probably want a more direct way for CodeGen to ask whether the constructor was deleted. Fixes PR31049. Differential Revision: https://reviews.llvm.org/D26822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287600 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR31029 by attaching an artificial debug location to msabi thunks.Adrian Prantl2016-11-161-0/+3
| | | | | | This was a latent bug that was recently uncovered by r286400. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287134 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Reuse getVFPtrOffsets instead of using getClassAtVTableLocationDavid Majnemer2016-10-271-40/+16
| | | | | | | | | | | | getClassAtVTableLocation hunts through virtual bases without using the MDC layout which is indicative of a bug. Instead, reuse the getVFPtrOffsets machinery to calculate which subobject within the MDC is responsible for the vfptr. Differential Revision: https://reviews.llvm.org/D25895 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285315 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor call emission to package the function pointer together withJohn McCall2016-10-261-17/+28
| | | | | | | | | | | abstract information about the callee. NFC. The goal here is to make it easier to recognize indirect calls and trigger additional logic in certain cases. That logic will come in a later patch; in the meantime, I felt that this was a significant improvement to the code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285258 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Fix assert when generating virtual function call with virtual bases ↵Hans Wennborg2016-10-191-9/+2
| | | | | | | | | | | | and -flto (PR30731) getClassAtVTableLocation() was calling ASTRecordLayout::getBaseClassOffset() on a virtual base, causing an assert. Differential Revision: https://reviews.llvm.org/D25779 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284624 91177308-0d34-0410-b5e6-96231b3b80d8
* Use unique_ptr for VPtrLocationsMap and VPtrInfoVector.Justin Lebar2016-10-101-29/+29
| | | | | | | | | | Reviewers: timshen Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25422 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283770 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Add /include directives for dynamic TLSDavid Majnemer2016-09-121-0/+8
| | | | | | | | | MSVC emits /include directives in the .drective section for the __dyn_tls_init function (decorated as ___dyn_tls_init@12 for 32-bit). This fixes PR30347. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281189 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Clean up implementation of vtable initializer builder. NFC.Peter Collingbourne2016-09-081-5/+3
| | | | | | | | | | | | | - Simplify signature of CreateVTableInitializer function. - Move vtable component builder to a separate function. - Remove unnecessary accessors from VTableLayout class. This is in preparation for a future change that will alter the type of the vtable initializer. Differential Revision: https://reviews.llvm.org/D22642 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280897 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Pass non-trivially-copyable objects indirectly on Windows ARMReid Kleckner2016-08-251-0/+6
| | | | | | | | | | This isn't exactly what MSVC does, unfortunately. MSVC does not pass objects with destructors but no copy constructors by address. More ARM expertise is required to really understand what should be done here. Fixes PR29136. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279764 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when generating code for __attribute__((naked)) member functions.Justin Lebar2016-07-271-0/+4
| | | | | | | | | | | | | | Summary: Previously this crashed inside EmitThisParam(). There should be no prelude for naked functions, so just skip the whole thing. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22715 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276925 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Improve VPtrInfo field names and doc commentsReid Kleckner2016-07-201-16/+16
| | | | | | | | | 'ReusingBase' was a terrible name. It might actually refer to the most derived class, which is not a base. 'BaseWithVPtr' was also bad, since again, it could refer to the most derived class. It was actually the first base to introduce the vptr, so now it is 'IntroducingObject'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@276120 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Support throwing/catching __unaligned typesDavid Majnemer2016-07-121-7/+15
| | | | | | | | We need to mark the appropriate bits in ThrowInfo and HandlerType so that the personality routine can correctly handle qualification conversions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275154 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Some code cleanupsDavid Majnemer2016-07-091-9/+6
| | | | | | | | Don't create unnecessary truncations if the result will not be used. Also prefer preforming math before the truncation, it makes it a little easier to reason about. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274984 91177308-0d34-0410-b5e6-96231b3b80d8
* [DebugInfo] Set DISubprogram ThisAdjustment in the MS ABIReid Kleckner2016-07-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@274326 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Start emitting checked loads when both trapping CFI and ↵Peter Collingbourne2016-06-251-6/+13
| | | | | | | | -fwhole-program-vtables are enabled. Differential Revision: http://reviews.llvm.org/D21122 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273757 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Update Clang to use the new type metadata.Peter Collingbourne2016-06-241-16/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D21054 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273730 91177308-0d34-0410-b5e6-96231b3b80d8
* Update clang for D20348Peter Collingbourne2016-06-141-7/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D20339 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272710 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Delegating constructors should not assume they are most derivedDavid Majnemer2016-05-131-9/+11
| | | | | | | | A constructor needs to know whether or not it is most derived in order to determine if it is responsible for virtual bases. Delegating constructors assumed they were most derived. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269465 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r267784, r267824 and r267830.Peter Collingbourne2016-04-281-10/+7
| | | | | | I have updated the compiler-rt tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267903 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r267784, r267824 and r267830.Benjamin Kramer2016-04-281-7/+10
| | | | | | | | | | It makes compiler-rt tests fail if the gold plugin is enabled. Revert "Rework interface for bitset-using features to use a notion of LTO visibility." Revert "Driver: only produce CFI -fvisibility= error when compiling." Revert "clang/test/CodeGenCXX/cfi-blacklist.cpp: Exclude ms targets. They would be non-cfi." git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267871 91177308-0d34-0410-b5e6-96231b3b80d8
* Rework interface for bitset-using features to use a notion of LTO visibility.Peter Collingbourne2016-04-271-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Bitsets, and the compiler features they rely on (vtable opt, CFI), only have visibility within the LTO'd part of the linkage unit. Therefore, only enable these features for classes with hidden LTO visibility. This notion is based on object file visibility or (on Windows) dllimport/dllexport attributes. We provide the [[clang::lto_visibility_public]] attribute to override the compiler's LTO visibility inference in cases where the class is defined in the non-LTO'd part of the linkage unit, or where the ABI supports calling classes derived from abstract base classes with hidden visibility in other linkage units (e.g. COM on Windows). If the cross-DSO CFI mode is enabled, bitset checks are emitted even for classes with public LTO visibility, as that mode uses a separate mechanism to cause bitsets to be exported. This mechanism replaces the whole-program-vtables blacklist, so remove the -fwhole-program-vtables-blacklist flag. Because __declspec(uuid()) now implies [[clang::lto_visibility_public]], the support for the special attr:uuid blacklist entry is removed. Differential Revision: http://reviews.llvm.org/D18635 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267784 91177308-0d34-0410-b5e6-96231b3b80d8
* Silencing warnings from MSVC 2015 Update 2. Both of these changes silence ↵Aaron Ballman2016-03-301-1/+1
| | | | | | "C4334 '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)". NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264932 91177308-0d34-0410-b5e6-96231b3b80d8
* EmitCXXStructorCall -> EmitCXXDestructorCall. NFC.Alexey Samsonov2016-03-101-8/+7
| | | | | | | This function is only used in Microsoft ABI and only to emit destructors. Rename/simplify it accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263081 91177308-0d34-0410-b5e6-96231b3b80d8
* Add whole-program vtable optimization feature to Clang.Peter Collingbourne2016-02-241-11/+8
| | | | | | | | | This patch introduces the -fwhole-program-vtables flag, which enables the whole-program vtable optimization feature (D16795) in Clang. Differential Revision: http://reviews.llvm.org/D16821 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261767 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Correctly handle dllimport'd explicit instantiation declaration w/ ↵David Majnemer2016-02-221-0/+3
| | | | | | | | | | | | | | vbases We gave a VBTable dllimport storage class and external linkage while also providing an initializer. An initializer is only valid if the VBTable has available_externally linkage. Fix this by setting the linkage to available_externally in situ while generating the initializer. This fixes PR26686. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261535 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert r260388 "[MS ABI] Never reference dllimport'd vtables""David Majnemer2016-02-111-4/+11
| | | | | | | | | | | | | This reverts commit r260449. We would supress our emission of vftable definitions if we thought another translation unit would provide the definition because we saw an explicit instantiation declaration. This is not the case with dllimport, we want to synthesize a definition of the vftable regardless. This fixes PR26569. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260548 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r260388 "[MS ABI] Never reference dllimport'd vtables"Hans Wennborg2016-02-101-11/+4
| | | | | | | This caused the compiler to fail with "invalid linkage type for global declaration" (PR26569). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260449 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence some MSVC false positive warnings about integer zexts and falling ↵Reid Kleckner2016-02-101-1/+1
| | | | | | off the end of a covered switch git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260411 91177308-0d34-0410-b5e6-96231b3b80d8