ethanhs / cce

commandline compiler explorer - use https://godbolt.org from your terminal!
MIT License
198 stars 14 forks source link

Proposal: Add local option from compile commands #10

Open siedentop opened 5 years ago

siedentop commented 5 years ago

Hi @ethanhs,

for myself, implemented in Python, I wrote a little script to open a C++ source file on a locally running instance of Compiler Explorer. The benefit is that you can use Compiler Explorer on a real source file of a real project. All flags will be passed to CE, so the resulting assembly is the same as in the project.

I would like to know whether you would like to see this as part of cce. Would you accept a patch to that effect?

How does it work?

Prerequisite:

  1. A local instance of compiler explorer is running. (Clone CE and run make).
  2. A compile_commands.json file exists in one of the parent directories of the target file.
  3. The target file can be in any language supported by CE and compile_commands.

Usage:

  1. Given some source file of interest (myfile.cc), call cce myfile.cc.
  2. The default browser is opened with a new tab, with myfile loaded in Compiler Explorer. The compile flags will be set correctly. This means you can open files that are part of a much bigger project and see the assembly output.

If this sounds like something you would like to see in CCE, please let me know and I'll prepare a new version in Rust.

ethanhs commented 5 years ago

I think this could be handy. I've been meaning to set up my own CE instance, but haven't gotten around to it, so sure, I think I'd accept this!