git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>,
	Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] Makefile: add support for generating JSON compilation database
Date: Tue, 1 Sep 2020 09:18:01 -0400	[thread overview]
Message-ID: <867D6718-E377-47B8-BD32-0800872B3DE0@gmail.com> (raw)
In-Reply-To: <20200901073827.GA3967005@coredump.intra.peff.net>


> Le 1 sept. 2020 à 03:38, Jeff King <peff@peff.net> a écrit :
> 
> On Sun, Aug 30, 2020 at 09:24:03PM -0700, Junio C Hamano wrote:
> 
>> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>> 
>>> On 2020-08-30 at 19:28:27, Philippe Blain via GitGitGadget wrote:
>>>> From: Philippe Blain <levraiphilippeblain@gmail.com>
>>>> 
>>>> Tools based on LibClang [1] can make use of a 'JSON Compilation
>>>> Database' [2] that keeps track of the exact options used to compile a set
>>>> of source files.
>>> 
>>> For additional context why this is valuable, clangd, which is a C
>>> language server protocol implementation, can use these files to
>>> determine the flags needed to compile a file so it can provide proper
>>> editor integration.  As a result, editors supporting the language server
>>> protocol (such as VS Code, or Vim with a suitable plugin) can provide
>>> better searching, integration, and refactoring tools.
>> 
>> I found that the proposed commit log was very weak to sell the
>> change; some of what you gave above should definitely help strenthen
>> it.
> 
> Likewise. Looking at the output, I'm confused how it would help with
> things like searching and refactoring. It might be nice to spell it out
> for those of us exposed to it for the first time (I tried following the
> links but remained unenlightened).

OK, I'll improve the commit message. I'm not at all an expert in this subject,
I just had to generate a compilation database myself to use the Sourcetrail source
explorer [1] with Git so I figured I'd share what I had done. Further exploration of the 
topic are in [2] and [3]. Note that I did try some of the tools listed in [2] before resorting
to modifying the Makefile, but these tools either did not work at all or produced wrong 
output (ex. strings in the JSON were not properly quoted, etc.)

> I'd also be curious to hear what advantages it gives to add a new
> Makefile knob rather than just letting interested parties add -MJ to
> their CFLAGS. Is it just a convenience to create the concatenated form?

Unfortunately this would not work because the '-MJ' flag needs a file name
to know where to put the JSON fragment.

Thanks,
Philippe.


[1] www.sourcetrail.com
[2] https://sarcasm.github.io/notes/dev/compilation-database.html
[3] https://eli.thegreenplace.net/2014/05/21/compilation-databases-for-clang-based-tools


  reply	other threads:[~2020-09-01 13:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30 19:28 [PATCH] Makefile: add support for generating JSON compilation database Philippe Blain via GitGitGadget
2020-08-30 22:10 ` brian m. carlson
2020-08-31  2:37   ` Philippe Blain
2020-08-31  4:24   ` Junio C Hamano
2020-09-01  7:38     ` Jeff King
2020-09-01 13:18       ` Philippe Blain [this message]
2020-09-02  1:33       ` brian m. carlson
2020-09-02  8:04         ` Jeff King
2020-08-30 22:17 ` Philippe Blain
2020-09-01 23:09 ` [PATCH v2] " Philippe Blain via GitGitGadget
2020-09-02 17:21   ` Junio C Hamano
2020-09-03 21:17     ` Philippe Blain
2020-09-03 21:31       ` Junio C Hamano
2020-09-03 22:04         ` Philippe Blain
2020-09-03 22:13   ` [PATCH v3] " Philippe Blain via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867D6718-E377-47B8-BD32-0800872B3DE0@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).