summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/dllexport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merging r340079:Reid Kleckner2018-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r340079 | rnk | 2018-08-17 13:59:27 -0700 (Fri, 17 Aug 2018) | 20 lines [MS] Mangle a hash of the main file path into anonymous namespaces Summary: This is needed to avoid conflicts in mangled names for codeview types in anonymous namespaces. In CodeView, types refer to each other typically through forward declarations, which contain mangled names. These names have to be unique, otherwise the debugger will look up the mangled name and find the wrong definition. Furthermore, ThinLTO will deduplicate the types, and debug info verification can fail when the types have the wrong sizes. This is PR38608. Fixes PR38609. Reviewers: majnemer, inglorion, hans Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50877 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_70@340087 91177308-0d34-0410-b5e6-96231b3b80d8
* [FileCheck] Add -allow-deprecated-dag-overlap to failing clang testsJoel E. Denny2018-07-111-6/+6
| | | | | | | | | | See https://reviews.llvm.org/D47106 for details. Reviewed By: probinson Differential Revision: https://reviews.llvm.org/D47172 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336844 91177308-0d34-0410-b5e6-96231b3b80d8
* IRgen: Mark aliases of ctors and dtors as unnamed_addr.Peter Collingbourne2018-06-181-1/+1
| | | | | | | | | This is not only semantically correct but ensures that they will not be marked as address-significant once D48155 lands. Differential Revision: https://reviews.llvm.org/D48206 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334982 91177308-0d34-0410-b5e6-96231b3b80d8
* Bring r328238 back with a fix.Rafael Espindola2018-03-231-0/+2
| | | | | | | | | | | | The issues was that we were setting hidden visibility if, when processing a hidden class, we found out that we needed to emit a reference to a vtable provided by the standard library. Original message: Set dso_local on vtables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328288 91177308-0d34-0410-b5e6-96231b3b80d8
* Set dso_local on __ImageBase.Rafael Espindola2018-03-221-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328266 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Set dso_local on vtables."Rafael Espindola2018-03-221-2/+0
| | | | | | | | This reverts commit r328238. Looks like it broke some buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328242 91177308-0d34-0410-b5e6-96231b3b80d8
* Set dso_local on vtables.Rafael Espindola2018-03-221-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328238 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Don't escape MS C++ names with \01Reid Kleckner2018-03-161-166/+166
| | | | | | | It is not needed after LLVM r327734. Now it will be easier to copy-paste IR symbol names from Clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327738 91177308-0d34-0410-b5e6-96231b3b80d8
* Propagate DLLAttr to friend re-declarations of member functionsStephan Bergmann2018-03-081-0/+10
| | | | | | | | | | | | ...that have already been constructed (e.g., in inner classes) while parsing the class definition. They would otherwise lack any DLLAttr inherited from the class, which are only set here (called from Sema::CheckCompletedClass) after the class definition has been parsed completely. Differential revision: https://reviews.llvm.org/D16632 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326990 91177308-0d34-0410-b5e6-96231b3b80d8
* Start setting dllimport/dllexport in setGVProperties.Rafael Espindola2018-03-011-3/+3
| | | | | | | | | | This is the next step in setting dso_local for COFF. The patches changes setGVProperties to first set dllimport/dllexport and changes a few cases that were setting dllimport/dllexport manually. With this a few more GVs are marked dso_local. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326397 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-commit r324991 "Fix for PR32992. Static const classes not exported."Hans Wennborg2018-02-261-0/+30
| | | | | | | | | | | | | Fix for PR32992. Static const classes not exported. Patch by zahiraam! (This re-lands the commit, but using S.MarkVariableReferenced instead of S.PendingInstantiations.push_back, and with an additional test.) Differential Revision: https://reviews.llvm.org/D42968 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326089 91177308-0d34-0410-b5e6-96231b3b80d8
* Bring r325915 back.Rafael Espindola2018-02-231-242/+242
| | | | | | | | | | | | | | | The tests that failed on a windows host have been fixed. Original message: Start setting dso_local for COFF. With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325940 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Start setting dso_local for COFF."Rafael Espindola2018-02-231-242/+242
| | | | | | | | This reverts commit r325915. It will take some time to fix the failures on a windows host. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325929 91177308-0d34-0410-b5e6-96231b3b80d8
* Start setting dso_local for COFF.Rafael Espindola2018-02-231-242/+242
| | | | | | | | | With this there are still some GVs where we don't set dso_local because setGVProperties is never called. I intend to fix that in followup commits. This is just the bare minimum to teach shouldAssumeDSOLocal what it should do for COFF. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325915 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r324991 "Fix for PR32992. Static const classes not exported."Hans Wennborg2018-02-141-19/+0
| | | | | | | | | | | | This broke the Chromium build on Windows; see https://crbug.com/812231 > Fix for PR32992. Static const classes not exported. > > Patch by zahiraam! > > Differential Revision: https://reviews.llvm.org/D42968 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325133 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR32992. Static const classes not exported.Hans Wennborg2018-02-131-0/+19
| | | | | | | | Patch by zahiraam! Differential Revision: https://reviews.llvm.org/D42968 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324991 91177308-0d34-0410-b5e6-96231b3b80d8
* PR35456: Track definedness of variable template specializations separately fromRichard Smith2017-12-021-7/+1
| | | | | | | | | | | whether they have an initializer. We cannot distinguish between a declaration of a variable template specialization and a definition of one that lacks an initializer without this, and would previously mistake the latter for the former. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319605 91177308-0d34-0410-b5e6-96231b3b80d8
* [test] Fix a typo in a test comment. NFC.Martin Storsjo2017-11-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319145 91177308-0d34-0410-b5e6-96231b3b80d8
* For dllexport class templates, export specializations of member functions ↵Hans Wennborg2017-10-101-0/+15
| | | | | | | | | | (PR34849) (take 2) This is a re-commit of r315025, but making sure to only apply this to specializations of class template member functions; i.e. not when the function itself is a template. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315330 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "For dllexport class templates, export specializations of member ↵Reid Kleckner2017-10-061-8/+0
| | | | | | | | functions (PR34849)" This reverts r315025, it caused http://crbug.com/772461 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315111 91177308-0d34-0410-b5e6-96231b3b80d8
* For dllexport class templates, export specializations of member functions ↵Hans Wennborg2017-10-051-0/+8
| | | | | | (PR34849) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315025 91177308-0d34-0410-b5e6-96231b3b80d8
* IRGen: Do not set dllexport on declarations.Peter Collingbourne2017-03-211-3/+3
| | | | | | | | | | | Setting dllexport on a declaration has no effect, as we do not emit export directives for declarations. Part of the fix for PR32334. Differential Revision: https://reviews.llvm.org/D31162 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298330 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Restrict explicit instantation definition dllexportShoaib Meenai2017-01-131-3/+17
| | | | | | | | | | | | | | | | In the case where the template class itself is already `dllexport`, the implicit instantiation will have already emitted all members. When we check the explicit instantiation definition, the `Specialization` will have inherited the `dllexport` attribute, so we'll attempt to emit all members for a second time, which causes an assertion failure. Restrict the exporting to when the `dllexport` attribute is newly introduced by the explicit instantiation definition. Fixes PR31608. Differential Revision: https://reviews.llvm.org/D28590 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291877 91177308-0d34-0410-b5e6-96231b3b80d8
* Split dllexport default constructor closure tests out into a separate fileReid Kleckner2017-01-091-57/+0
| | | | | | test/CodeGenCXX/dllexport.cpp has grown quite large at this point. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291452 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Fix function type mangling of default ctor closuresReid Kleckner2017-01-091-0/+6
| | | | | | | | | Use the canonical decl in pointer comparisons with the default constructor closure decl. Otherwise we don't produce the correct "@@QAEXXZ" mangling, which essentially means "void(void) thiscall public instance method". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291448 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Instantiate default args during instantiation of exported default ctorsReid Kleckner2017-01-051-0/+12
| | | | | | | | | | | | | | | | | | | | Summary: Replace some old code that probably pre-dated the change to delay emission of dllexported code until after the closing brace of the outermost record type. Only uninstantiated default argument expressions need to be handled now. It is enough to instantiate default argument expressions when instantiating dllexported default ctors. This also fixes some double-diagnostic issues in this area. Fixes PR31500 Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28274 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291045 91177308-0d34-0410-b5e6-96231b3b80d8
* Make '-disable-llvm-optzns' an alias for '-disable-llvm-passes'.Chandler Carruth2016-12-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Much to my surprise, '-disable-llvm-optzns' which I thought was the magical flag I wanted to get at the raw LLVM IR coming out of Clang deosn't do that. It still runs some passes over the IR. I don't want that, I really want the *raw* IR coming out of Clang and I strongly suspect everyone else using it is in the same camp. There is actually a flag that does what I want that I didn't know about called '-disable-llvm-passes'. I suspect many others don't know about it either. It both does what I want and is much simpler. This removes the confusing version and makes that spelling of the flag an alias for '-disable-llvm-passes'. I've also moved everything in Clang to use the 'passes' spelling as it seems both more accurate (*all* LLVM passes are disabled, not just optimizations) and much easier to remember and spell correctly. This is part of simplifying how Clang drives LLVM to make it cleaner to wire up to the new pass manager. Differential Revision: https://reviews.llvm.org/D28047 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290392 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: New vtable group representation: struct of vtable arrays.Peter Collingbourne2016-12-131-3/+3
| | | | | | | | | 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
* [Sema] Respect DLL attributes more faithfullyShoaib Meenai2016-12-051-0/+7
| | | | | | | | | | | On MSVC, if an implicit instantiation already exists and an explicit instantiation definition with a DLL attribute is created, the DLL attribute still takes effect. Make clang match this behavior for exporting. Differential Revision: https://reviews.llvm.org/D26657 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288682 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-commit r270748 "clang-cl: Treat dllimport explicit template instantiation ↵Hans Wennborg2016-05-261-8/+5
| | | | | | | | | | definitions as declarations (PR27810, PR27811)" Also make explicit instantiation decls not apply to nested classes when targeting MSVC. That dll attributes are not inherited by inner classes might be the explanation for MSVC's behaviour here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270897 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r270748 "clang-cl: Treat dllimport explicit template instantiation ↵Hans Wennborg2016-05-251-5/+8
| | | | | | | | | definitions as declarations (PR27810, PR27811)" It seems to have broken the sanitizer-windows bot. Reverting while investigating. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270754 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-cl: Treat dllimport explicit template instantiation definitions as ↵Hans Wennborg2016-05-251-8/+5
| | | | | | | | | | | declarations (PR27810, PR27811) This matches what MSVC does, and should make compiles faster by avoiding to unnecessarily emit a lot of code. Differential Revision: http://reviews.llvm.org/D20608 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270748 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSVC2015] dllexport for defaulted special class membersDmitry Polukhin2016-05-241-8/+33
| | | | | | | | | | | | Clang doesn't dllexport defaulted special member function defaulted inside class but does it if they defaulted outside class. MSVC doesn't make any distinction where they were defaulted. Also MSVC 2013 and 2015 export different set of members. MSVC2015 doesn't emit trivial defaulted x-tors but does emit copy assign operator. Differential revision: http://reviews.llvm.org/D20422 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270535 91177308-0d34-0410-b5e6-96231b3b80d8
* [ms][dll] #27212: Generating of implicit special members should take into ↵Dmitry Polukhin2016-05-131-3/+20
| | | | | | | | | | | | | | account MSVC compatibility version Clang creates implicit move constructor/assign operator in all cases if there is std=c++11. But MSVC supports such generation starting from version 1900 only. As result we have some binary incompatibility. Differential Revision: http://reviews.llvm.org/D19156 Patch by Andrew V. Tischenko git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269400 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a test for PR26076.Nico Weber2016-05-051-0/+14
| | | | | | | | r262056 accidentally fixed this. Add a test to ensure it doesn't regress. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268625 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix broken tests from no-jump-table commitNirav Dave2016-04-051-6/+6
| | | | | | | | | | | | Summary: Fix failing tests from no-jump-table flag addition Reviewers: jyknight Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18801 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265439 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "For MS ABI, emit dllexport friend functions defined inline in class"Reid Kleckner2016-03-171-2/+0
| | | | | | | | | This reverts commit r263738. This appears to cause a failure in CXX/temp/temp.decls/temp.friend/p1.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263740 91177308-0d34-0410-b5e6-96231b3b80d8
* For MS ABI, emit dllexport friend functions defined inline in classReid Kleckner2016-03-171-0/+2
| | | | | | | | | | | | Summary: ...as that is apparently what MSVC does Reviewers: rnk Patch by Stephan Bergmann Differential Revision: http://reviews.llvm.org/D15267 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263738 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a few dllimport/dllexport tests. NFCReid Kleckner2016-03-021-0/+24
| | | | | | | | | | | | | | | | | | | | Summary: This change just adds tests for some corner cases of dllimport/dllexport, primarily for some static methods. We plan to enable dllimport/dllexport support for the PS4, and these additional tests are for points we previously were testing internally. -Warren Ristow SN Systems - Sony Computer Entertainment Group Reviewers: rnk Subscribers: silvas Differential Revision: http://reviews.llvm.org/D17775 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262442 91177308-0d34-0410-b5e6-96231b3b80d8
* [dllexport] Sort out emission order of delayed exported classesReid Kleckner2016-02-261-0/+11
| | | | | | | | | | | | | | | | Relands r260194 with a fix. If we have a template that transitions from an extern template to an explicitly instantiated dllexport template, we would add that class to the delayed exported class list without flushing it. For explicit instantiations, we can just flush the list of delayed classes immediately. We don't have to worry about the bug fixed in r260194 in this case because explicit instantiations can only occur at file and namespace scope. Fixes PR26490. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262056 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Avoid forcing emission of delayed dllexported classes on template ↵Reid Kleckner2016-02-091-11/+0
| | | | | | | | | | instantiation" This reverts commit r260194. It caused PR26549. There's probably a better way to do this also. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260241 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid forcing emission of delayed dllexported classes on template instantiationReid Kleckner2016-02-091-0/+11
| | | | | | Fixes PR26490 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260194 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] update test cases for explicit pointee types on global ↵David Blaikie2015-09-111-1/+1
| | | | | | aliases git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247380 91177308-0d34-0410-b5e6-96231b3b80d8
* Delay emitting members of dllexport classes until the class is fully parsed ↵Hans Wennborg2015-08-151-1/+49
| | | | | | | | | | | | | | | | | (PR23542) This enables Clang to correctly handle code such as: struct __declspec(dllexport) S { int x = 42; }; where it would otherwise error due to trying to generate the default constructor before the in-class initializer for x has been parsed. Differential Revision: http://reviews.llvm.org/D11850 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245139 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Stick constructor closures in an IR COMDAT groupDavid Majnemer2015-06-301-6/+6
| | | | | | | We no-longer stick linkonce_odr entities in COMDATs in the backend. Instead, we rely on the IR COMDAT mechanism. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241117 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS Compatibility] Handle cleanups we create for a ctor closureDavid Majnemer2015-06-111-0/+16
| | | | | | This fixes PR23801. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239503 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable DLL attribute propagation on explicit instantiation definitions (PR23770)Hans Wennborg2015-06-091-0/+5
| | | | | | | | This is a follow-up to r225570 which enabled adding DLL attributes when a class template goes from explicit instantiation declaration to explicit instantiation definition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239375 91177308-0d34-0410-b5e6-96231b3b80d8
* MinGW: don't allow adding DLL attribute if template already has explicit ↵Hans Wennborg2015-06-091-0/+2
| | | | | | | | instantiation declaration This is a follow-up to r238266 which failed to take MinGW into account. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239374 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable propagation of dll attributes to previously instantiated base class ↵Hans Wennborg2015-06-091-2/+17
| | | | | | | | | | | | | | | templates in some cases It is safe to add a dll attribute if the base class template previously only had an explicit instantiation declaration, or was implicitly instantiated. I both those cases, the members would not have been codegenned yet. In the case of explicit instantiation declaration this is natural, and for implicit instantiations, codegen is deferred (see r225570). This is work towards fixing PR23770. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239373 91177308-0d34-0410-b5e6-96231b3b80d8
* Get the dll storage class right for structors of classes exported/imported ↵Hans Wennborg2015-05-281-1/+2
| | | | | | | | | via explicit instantiation (PR23667) This is a follow-up to r238266. It turned out structors are codegened through a different path, and didn't get the storage class set in EmitGlobalFunctionDefinition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238443 91177308-0d34-0410-b5e6-96231b3b80d8