On Mon, Jan 4, 2016 at 5:27 PM, Ben Boeckel <[email protected]> wrote:

> On Mon, Jan 04, 2016 at 16:47:38 -0500, Mike Shal wrote:
> > Attached is a patch that might provide a good start for this - it uses a
> > trimmed down version of the 'tup graph' logic. However, it dumps every
> > command, not just compilation commands. I'm not sure if that would mess
> up
> > the compilation database. Also, I'm not sure how to generate the "file"
> > line - is that required? Maybe it could just pull it out of the command
> > string.
>
> It is described as "the translation unit’s main file", so I'd say it
> should be the %f argument of the command. It also says that it is used
> by tools for searching the database, so I'd say it's fairly important.
> For any command without a %f (whether used literally in the command or
> not), it might be best to just skip those (i.e., any tool using this
> file would probably not care about Python script commands).
>

Hmm, in that case it might be best instead to generate this at the parser
level rather than trying to do it after the fact from the database.
Unfortunately the context of which file was listed from "%f" may be lost -
they look the same as order-only inputs in the database. Additionally,
parser level dependencies ("sticky links" in the tup source & the database)
are ignored on normal files, so there may not even be a link from foo.c to
the compilation command until the command actually executes.

So we'd probably want something that calls tup_db_reparse_all() to force it
to re-parse all Tupfiles, and then have an alternate parsing mode that
spits out things into the compilation database instead of the tup database
(this would probably just be a separate implementation of
parser.c:do_rule()).

-Mike

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to