This is an archive of the discontinued LLVM Phabricator instance.

[Tooling] Switch JSONCompilationDatabase to use JSON parser.
Changes PlannedPublic

Authored by sammccall on Aug 8 2018, 5:28 AM.

Details

Reviewers
None
Summary

Rather than hold all the JSON source in memory, as well as the YAML structures
needed to index into it, we parse eagerly into CompileCommand structures, which
simplifies the implementation a lot.

Possibly at the cost of performance/memory usage, need to measure that.
(I'd expect that eager parsing with string deduplication would be fine at least)

Behavior changes:

  • rejects noise at end of JSON files (see fixed test), rather than silently accepting
  • ignores unknown attributes, rather than rejecting
  • when "arguments" is a single-element array, no longer tries to parse it (I guess this was a bug)

Diff Detail

Event Timeline

sammccall created this revision.Aug 8 2018, 5:28 AM
sammccall updated this revision to Diff 159690.Aug 8 2018, 5:31 AM

(just updating description)

sammccall planned changes to this revision.Aug 8 2018, 5:49 AM
sammccall edited the summary of this revision. (Show Details)
sammccall removed reviewers: ioeric, klimek.
sammccall added subscribers: ioeric, klimek.

Nevermind, this is like 5x slower to load the chromium CDB. probably because of all the little non-arena allocations.
I'll profile and fix it when I get bored again.