Fix for PR32992. Static const classes not exported.
ClosedPublic

Authored by zahiraam on Tue, Feb 6, 7:33 AM.

Diff Detail

Repository
rL LLVM
zahiraam created this revision.Tue, Feb 6, 7:33 AM
rnk added a reviewer: hans.Tue, Feb 6, 3:42 PM
hans added a comment.Wed, Feb 7, 1:58 AM

Interesting!

lib/Sema/SemaDeclCXX.cpp
5467 ↗(On Diff #132999)

Maybe rename this to ReferenceDllExportedMembers now that it applies to variables as well.

5482 ↗(On Diff #132999)

Let's move the MD part down until where it's used.

5485 ↗(On Diff #132999)

The intendation looks off here. Can you run it through clang-format maybe? It would also be good with a comment explaining why the code is here.

5487 ↗(On Diff #132999)

Does the 'const' really make a difference for whether the member should be exported?

test/SemaCXX/export_static_const.cpp
1 ↗(On Diff #132999)

This test doesn't seem to have any "RUN" line, which means nothing actually gets tested.

Can you add a case to test/CodeGenCXX/dllexport.cpp instead?

zahiraam updated this revision to Diff 133498.Thu, Feb 8, 2:58 PM
zahiraam marked 5 inline comments as done.
zahiraam added inline comments.
lib/Sema/SemaDeclCXX.cpp
5487 ↗(On Diff #132999)

No it doesn't. I removed that condition.

hans added a comment.Fri, Feb 9, 12:57 AM

Thanks! Just a few more comments.

lib/Sema/SemaDeclCXX.cpp
5500 ↗(On Diff #133498)

Since VD is a class member, I think isDefinedOutsideFunctionOrMethod() is always true and not interesting to check.

test/CodeGenCXX/dllexport.cpp
571 ↗(On Diff #133498)

Can you move this check down where the class etc. are declared below? Maybe also add a comment explaining what it's testing and reference the bug number.

985 ↗(On Diff #133498)

No need for the semicolon in the empty function, here and below. The rest of the file doesn't use this style.

zahiraam updated this revision to Diff 133643.Fri, Feb 9, 10:26 AM
zahiraam marked 3 inline comments as done.
hans accepted this revision.Mon, Feb 12, 1:03 AM

Looks good to me. Do you have commit access or would you like me to commit it for you?

This revision is now accepted and ready to land.Mon, Feb 12, 1:03 AM

Looks good to me. Do you have commit access or would you like me to commit it for you?

Hello.
Please go ahead and to the commit.
Thanks.

This revision was automatically updated to reflect the committed changes.