Description
It would be interesting if arduino-builder could generate a "compilation database", as a side effect of building a sketch. This is a JSON file containing the gcc commands used to compile each file in the project. Third party tools can use such a database to figure out the compilation flags used, to simplify analysis of the source code, or to easily support code completion in a third-party editor.
For docs, see http://clang.llvm.org/docs/JSONCompilationDatabase.html According to the YouCompleteMe docs, this file is customary called compilation_commands.json
: https://github.com/Valloric/YouCompleteMe#option-1-use-a-compilation-database
Generating such a file is not entirely trivial, especially since files are currently compiled from a temporary directory (so the commands should probably be slightly faked using the original filenames) and because .ino files are preprocessed before being compiled (but for the purposes of completion, it might be sufficient if the flags for each .ino file can be read separatey).
This might need some further thought, but I wanted to create this issue to track any discussion around this topic.