This is an archive of the discontinued LLVM Phabricator instance.

[mlir][py] Fix python modules build with clang-cl due to requiring exceptions
ClosedPublic

Authored by zero9178 on Jan 6 2023, 1:08 PM.

Details

Summary

The generator expression previously used to enable exceptions would not work since the compiler id of clang-cl is Clang, even if used via clang-cl.

The patch fixes that by replacing the generator expression with simple logic, setting the right compiler flags for all MSVC like compilers (including clang-cl) and all GCC like compilers.

Diff Detail

Event Timeline

zero9178 created this revision.Jan 6 2023, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 1:08 PM
zero9178 requested review of this revision.Jan 6 2023, 1:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 1:08 PM
stellaraccident added inline comments.Jan 6 2023, 1:27 PM
mlir/cmake/modules/AddMLIRPython.cmake
613

I assume this variable is available when used out of tree but need to double check (and afk right now).

zero9178 added inline comments.Jan 6 2023, 1:31 PM
mlir/cmake/modules/AddMLIRPython.cmake
613

Yes. MLIR does include(AddLLVM) in a standalone build which then has include(DetermineGCCComptaible) which sets this variable.
It is also used by other subprojects that that have working standalone builds.

stellaraccident accepted this revision.Jan 6 2023, 1:42 PM

Perfect. Thanks for checking. Do you need help landing this patch?

This revision is now accepted and ready to land.Jan 6 2023, 1:42 PM

Perfect. Thanks for checking. Do you need help landing this patch?

No, but thanks for asking!