This is an archive of the discontinued LLVM Phabricator instance.

Add .cmt and .cmti files for OCaml bindings
ClosedPublic

Authored by tnkhanh on Oct 1 2021, 7:33 PM.

Details

Summary

We can build .cmt and .cmti files for easier code navigation for OCaml bindings

Event Timeline

tnkhanh created this revision.Oct 1 2021, 7:33 PM
tnkhanh requested review of this revision.Oct 1 2021, 7:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2021, 7:33 PM
tnkhanh abandoned this revision.Oct 1 2021, 7:36 PM
tnkhanh updated this revision to Diff 376669.Oct 1 2021, 9:38 PM

Add .cmt and .cmti files for OCaml bindings

tnkhanh updated this revision to Diff 376670.Oct 1 2021, 9:40 PM
This comment was removed by tnkhanh.
tnkhanh retitled this revision from Add .cmt and .cmti files for OCaml to Add .cmt and .cmti files for OCaml bindings.Oct 1 2021, 9:41 PM
tnkhanh added a reviewer: mgorny.

I tried to add Peter Zotov (whitequark) as reviewer but couldn't find them.

tnkhanh edited the summary of this revision. (Show Details)Oct 2 2021, 12:11 AM

The changes here look reasonable enough to me, but unfortunately, I don't know the first thing about OCaml so I'm not certain how valid my review is.

arbipher accepted this revision.Oct 3 2021, 10:32 PM

This change looks good to me. Thank you all.

I tested it (the latest llvm commit plus this diff) on my ubuntu 20.04 on wsl. The build of static OCaml binding works fine. I can dump the cmt cmti file with ocamlcmt tool.

The .cmt and .cmit files are just binary format of the typed AST (ocaml manudl on cmt, the last para of the section), and used by code tools. They are useful and harmless.


Usually, the LLVM OCaml binding is provided for OCaml users via opam, just like cargo for rust or pip for python. I made the opam package for llvm 12 binding.
I can make the newly released llvm 13 binding later, with this change as a patch and some slight change there - to copy these cmt/cmti files.

This revision is now accepted and ready to land.Oct 3 2021, 10:32 PM
xgupta added a subscriber: xgupta.Oct 3 2021, 11:30 PM

@tnkhanh please rebase the patch and resolve conflict with clang-tools-extra/docs/ReleaseNotes.rst. Then I will commit this patch on your behalf.

@arbipher Is this patch going to be in the opam llvm 13 package?

arbipher added a comment.EditedOct 6 2021, 10:24 AM

@tnkhanh
I just made it including this patch, and this is the PR for opam-llvm-13.

I tested it on my ubuntu (in wsl).

@arbipher Thanks! That is great!