This is an archive of the discontinued LLVM Phabricator instance.

[Clang][docs]JSONLinkDatabase
Needs ReviewPublic

Authored by Glebuska on May 10 2021, 11:11 PM.

Details

Summary

Hello,

We provide you with a possible standard for link commands. We would be glad if this format, albeit with minor changes, reaches the approval stage. This format is needed for cmake developers, but most likely they are not the only ones. Check out the discussion with cmake developers for more information here.

Also, while we are not sure that the format will be preserved, we are thinking about using the first field to store meta information. Example here.

Diff Detail

Event Timeline

Glebuska requested review of this revision.May 10 2021, 11:11 PM
Glebuska created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 10 2021, 11:12 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Glebuska edited the summary of this revision. (Show Details)May 11 2021, 12:02 AM
Glebuska updated this revision to Diff 344301.May 11 2021, 12:08 AM
Glebuska edited the summary of this revision. (Show Details)

Updating D102216: JSONLinkDatabase

Glebuska retitled this revision from JSONLinkDatabase to [Clang][docs]JSONLinkDatabase.May 11 2021, 10:22 AM
Glebuska updated this revision to Diff 344773.May 12 2021, 4:59 AM

Updating D102216: [Clang][docs]JSONLinkDatabase

Glebuska edited the summary of this revision. (Show Details)May 12 2021, 4:59 AM
Glebuska added reviewers: chandlerc, rsmith.
Glebuska edited reviewers, added: r4nt; removed: chandlerc, rsmith.May 18 2021, 4:45 AM

Hi, thanks for writing this up! This is an interesting idea and whole-program information is something our tooling libraries don't cover.

A few high-level thoughts:

  • this has wider scope and probably have wider discussion than a code review, an RFC on the cfe-dev mailing list is the usual starting point
  • it's unusual for LLVM to define file-formats without tools for working with them. compile_commands.json was developed in tandem with a library to use it for clang-based analysis. Do you have plans to develop such tools in the LLVM tree?
  • whether in or out of the LLVM tree, what are the most important use cases for such a format? Why was this design picked over others to satisfy them?
  • is command/flags the right abstraction for information about how source code is ultimately linked? It follows the compile_commands.json precedent, but the underlying reasons seem much weaker. (With parsing commands there are a huge diversity of options, it's critical we preserve them ~all exactly, and there's a clear impl strategy for doing so)
  • if the database can contain arbitrarily mixed linker/object file manipulation/non-linker commands and the tool is responsible for guessing/interpreting them seems to mean this format will be hard to consume robustly.
  • one motivating case is in the readme (resolving one of multiple definitions in the code base). IIUC the suggested implementation is to index the codebase using compile_commands.json, and then use link info to choose between multiple definitions. This seems quite narrow (only helps when there are multiple defintions, but not if they're each linked to the caller in different binaries), doesn't yield a particularly *efficient* implementation, and seems to admit less invasive solutions (e.g. a subset compile_commands.json that only covers sources for one binary).

(Sorry about the delay, I've been off work for a few weeks)

silvas resigned from this revision.Jul 1 2021, 10:57 AM