This is an archive of the discontinued LLVM Phabricator instance.

Adds __str__ support to python mlir.ir.MlirModule.
ClosedPublic

Authored by stellaraccident on Aug 16 2020, 8:55 PM.

Details

Summary
  • Also raises an exception on parse error.
  • Removes placeholder smoketest.
  • Adds docstrings.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 16 2020, 8:55 PM
stellaraccident requested review of this revision.Aug 16 2020, 8:55 PM
ftynse accepted this revision.Aug 17 2020, 3:57 AM
ftynse added inline comments.
mlir/lib/Bindings/Python/IRModules.cpp
19

Please fix linter warnings. MLIR uses camelCase for variables, I've seen kConstantName for constants.

50

What does the + do?

This revision is now accepted and ready to land.Aug 17 2020, 3:57 AM

Fix lint and remove lambda decay.

mlir/lib/Bindings/Python/IRModules.cpp
19

Thanks - I started doing that then second guessed thinking that was just Google style (too many style switches recently).

50

It is just the unary plus but the effect is subtle: It causes an explicit decay of a (non capturing) C++ closure to a raw function pointer.

Here is a good explanation: https://stackoverflow.com/questions/18889028/a-positive-lambda-what-sorcery-is-this

I just checked that it is not required in this case and removed it (there might be a compiler version dependency: I remember that on older compilers we had to use this idiom frequently when bridging C/C++ callbacks on prior projects).

This revision was landed with ongoing or failed builds.Aug 17 2020, 9:47 AM
This revision was automatically updated to reflect the committed changes.
mlir/test/Bindings/Python/ir_module_test.py