This makes us handle static locals in exported/imported functions correctly.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/MicrosoftCXXABI.cpp | ||
---|---|---|
1429 ↗ | (On Diff #10392) | "class" |
lib/Sema/SemaDecl.cpp | ||
9112 ↗ | (On Diff #10392) | There's already a getDLLAttr() function somewhere, but I guess it's not available here. Maybe this helper could be moved to SemaInternal.h? |
test/CodeGenCXX/dllexport.cpp | ||
257 ↗ | (On Diff #10392) | These tests should be at the end of the section for globals (like in SemaCXX/dllexport.cpp) IMO. Same goes for the dllimport tests. |
262 ↗ | (On Diff #10392) | These checks can be MSC-DAG. |
267 ↗ | (On Diff #10392) | Superfluous ";" |
269 ↗ | (On Diff #10392) | These checks can be MSC-DAG, and please add a comment that MinGW doesn't do this and is not just forgotten here (at least my tests with GCC show this to be true). |
Thanks for the review!
It would be nice to have similar tests for the Itanium ABI, but I suspect that you are less interested in that.
As Nico pointed out, they don't seem to export the static locals :/
lib/CodeGen/MicrosoftCXXABI.cpp | ||
---|---|---|
1429 ↗ | (On Diff #10392) | Done. |
lib/Sema/SemaDecl.cpp | ||
9112 ↗ | (On Diff #10392) | Sounds good to me. |
test/CodeGenCXX/dllexport.cpp | ||
257 ↗ | (On Diff #10392) | Done. |
262 ↗ | (On Diff #10392) | Done. |
267 ↗ | (On Diff #10392) | Removed. |
269 ↗ | (On Diff #10392) | Done. |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
9108 ↗ | (On Diff #10407) | Should this go before checkAttributesAfterMerging? Consider this obnoxious test case: int f(); inline __declspec(dllexport) int g() { static __declspec(dllimport) int x = f(); return x; } |
lib/Sema/SemaDecl.cpp | ||
---|---|---|
9108 ↗ | (On Diff #10407) | Local variables cannot have explicit dll attributes. They can only get them by inheriting from the function they're part of, so calling checkAttributesAfterMerging to check up on the attribute we just added seems redundant. |
lgtm
lib/Sema/SemaDecl.cpp | ||
---|---|---|
9108 ↗ | (On Diff #10407) | OK. I assume this is covered by Nico's extensive test cases. :) |
LGTM
lib/Sema/SemaDecl.cpp | ||
---|---|---|
9108 ↗ | (On Diff #10407) | Yup, this is handled by requiring external linkage. |