-
Notifications
You must be signed in to change notification settings - Fork 13.5k
dllexport/dllimport should be allowed for full classes/structs #11542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Didn't bug 10978 help you? |
No, that only removed the "unknown attribute" warnings for x86_64. This bug is for dllexporting whole classes, as in: Testcase is quite simple: class __declspec(dllexport) A Clang output: testcase.cpp:2:18: warning: 'dllexport' attribute only applies to variables and See http://msdn.microsoft.com/en-us/library/81h27t8c.aspx for why this is wrong. |
Confirmed, as of r156715. |
I'd like to try your patch, but I get this when I try to apply it: Ruben@Ruben_Laptop /m/Development/Source/LLVM/tools/clang |
I added a regenerated patch (contents should be the same). Let me know if that works. |
This patch applies cleanly to SVN head. I get a compiler error (and a bunch of warnings) though: [ 79%] Building CXX object tools/clang/lib/Sema/CMakeFiles/clangSema.dir/SemaDeclCXX.cpp.obj |
Damn. To make it compile change the call from HandleClassMemberDLLAttr() to HandleRecordMemberDLLAttr() and it should work. Seems also there's a warning comparing the enum values, I'll take a look into it later. |
With Clang r161110, your patch applied (and the typos corrected), I get a crash compiling Qt after a large number of dllimport ignored warnings: Example warning: Stack dump:
clang++: error: clang frontend command failed due to signal (use -v to see invocation) I can attach the other crash files, but only if that helps. I could also give you instructions to test building Qt yourself if you think that's more helpful. |
Thanks for testing this, it's really helpful. I'm working on other MS ABI patches, but once I finish them I'll look into this again. About the crash, a real stack trace would be more helpful in figuring out the problem. |
Clang crash diagnostic msg |
Taking this as part of a larger patch for proper dllexport/dllimport support. I use the same idea of propagating the attributes to the members. But this doesn't work with class templates because the inherited flag is not preserved when the attributes are cloned for the instantiation. Might be a bug/oversight in tablegen. |
Any updates on this? Clang top of trunk still warns on unused attribute, and it seems more is broken with dllexport, but that's for later. I (and many people) would already be happy with non-template class dllexport, I think, and this would be a great step forward. |
Ruben, Nico's work is in http://llvm-reviews.chandlerc.com/D1110 which was just accepted and he made a series of commits today (See r199203..r199207 on the LLVM repo). He reverted the larger patch short afterwards due to some problem on Clang but it seems that, at last, this issue is going to be resolved. |
D1110 doesn't actually fix this bug, but is a requirement. I have this bug mostly fixed (a problem are virtual classes mainly because of ABI issues). I just have to break it down into more review-friendly pieces. |
Can you please elaborate on what are the problems with virtual classes? |
Any chance you can post your work in progress? This blocking building mozilla so it would be nice to try with your patches. |
I've searched by inbox for pending patches to review, but I don't see any. I'm happy to review away when one is out. Nico already laid the groundwork in LLVM, so this should be a Small Matter of Code in Clang. |
*** Bug llvm/llvm-bugzilla-archive#19516 has been marked as a duplicate of this bug. *** |
*** Bug llvm/llvm-bugzilla-archive#19738 has been marked as a duplicate of this bug. *** |
This is now supported (modulo bugs). |
mentioned in issue llvm/llvm-bugzilla-archive#13707 |
mentioned in issue llvm/llvm-bugzilla-archive#18256 |
1 similar comment
mentioned in issue llvm/llvm-bugzilla-archive#18256 |
mentioned in issue llvm/llvm-bugzilla-archive#19150 |
mentioned in issue llvm/llvm-bugzilla-archive#19516 |
mentioned in issue llvm/llvm-bugzilla-archive#19726 |
mentioned in issue llvm/llvm-bugzilla-archive#19738 |
mentioned in issue #7187 |
Extended Description
Currently, Clang does not support dll[ex|im]porting full classes, although this is common practice and perfectly legal (see for example the Qt codebase).
The text was updated successfully, but these errors were encountered: