This is an archive of the discontinued LLVM Phabricator instance.

[MSVC] Silence -Wnon-virtual-dtor on DIA APIs
ClosedPublic

Authored by aganea on Dec 27 2021, 8:04 AM.

Details

Summary

When building LLVM with Clang 13.0 on Windows & targetting MSVC, I see a bunch of -Wnon-virtual-dtor warnings on DIA (Debug Interface Access) COM APIs.

Diff Detail

Event Timeline

aganea requested review of this revision.Dec 27 2021, 8:04 AM
aganea created this revision.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 27 2021, 8:04 AM
aganea edited the summary of this revision. (Show Details)Dec 27 2021, 8:04 AM
hans added inline comments.Jan 3 2022, 5:51 AM
clang/lib/Driver/ToolChains/MSVC.cpp
54 ↗(On Diff #396312)

Since it's in our repository, would it be possible to fix clang/lib/Driver/ToolChains/MSVCSetupApi.h to be warning free? If it's not possible to fix the classes the warning refers to, I think it would at least be nicer to move the pragma into that file.

llvm/include/llvm/DebugInfo/PDB/DIA/DIASupport.h
34 ↗(On Diff #396312)

I thought this warning should be suppressed for system headers. Isn't that working here?

aganea updated this revision to Diff 397069.Jan 3 2022, 8:27 AM
aganea marked 2 inline comments as done.

As suggested by @hans

aganea added inline comments.Jan 3 2022, 8:27 AM
llvm/include/llvm/DebugInfo/PDB/DIA/DIASupport.h
34 ↗(On Diff #396312)

Good point, because it wasn't included as a system header in the first place.

hans accepted this revision.Jan 3 2022, 10:14 AM

lgtm

This revision is now accepted and ready to land.Jan 3 2022, 10:14 AM
This revision was landed with ongoing or failed builds.Jan 3 2022, 10:29 AM
This revision was automatically updated to reflect the committed changes.
aganea added a subscriber: dblaikie.EditedJan 3 2022, 1:34 PM

I was wondering, can we mandate LLVM_ENABLE_WERROR=ON for all bots at least? (or maybe enable it through cmake, if ever there's a setting to detect we're running as a bot)
Or just reverse the default setting on the main branch, ie. make LLVM_ENABLE_WERROR=ON by default and let users disable it locally. I think that would encourage developers to care more about warnings? Release branches could have it disabled somehow, to accommodate for the changing compiler environments. Was this discussed before?

hans added a comment.Jan 5 2022, 8:33 AM

I was wondering, can we mandate LLVM_ENABLE_WERROR=ON for all bots at least? (or maybe enable it through cmake, if ever there's a setting to detect we're running as a bot)
Or just reverse the default setting on the main branch, ie. make LLVM_ENABLE_WERROR=ON by default and let users disable it locally. I think that would encourage developers to care more about warnings? Release branches could have it disabled somehow, to accommodate for the changing compiler environments. Was this discussed before?

I don't remember whether this was discussed before. I think it would be a good topic for llvm-dev.

It would be nice to have at least one buildbot using -Werror, with some specific blessed compiler version, but for that to not get annoying I think we'd need to surface those warnings in code reviews, and even if we have system a for that today it doesn't seem to be working very well.

I was wondering, can we mandate LLVM_ENABLE_WERROR=ON for all bots at least? (or maybe enable it through cmake, if ever there's a setting to detect we're running as a bot)
Or just reverse the default setting on the main branch, ie. make LLVM_ENABLE_WERROR=ON by default and let users disable it locally. I think that would encourage developers to care more about warnings? Release branches could have it disabled somehow, to accommodate for the changing compiler environments. Was this discussed before?

I don't remember whether this was discussed before. I think it would be a good topic for llvm-dev.

It would be nice to have at least one buildbot using -Werror, with some specific blessed compiler version, but for that to not get annoying I think we'd need to surface those warnings in code reviews, and even if we have system a for that today it doesn't seem to be working very well.

Not sure we'd be much worse off than we are today if some buildbots enabled -Werror without phabricator pre-commit integration. I'm pretty sure we've had -Werror buildbots in the past in that situation. In some ways it'd be ideal if it were a bootstrap build so we ensure LLVM's always warning-clean with current Clang, but that means longer turnaround. (wonder if we could configure buildbots to fail on warnings, but not enable -Werror - so the buildbot would also still produce other useful results, rather than halting on the first warning & potentially hiding/delaying other useful findings)