[PATCH] D90121: clang-format: Add a consumer to diagnostics engine

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 06:46:24 PST 2020


thakis added a comment.

Thanks for the test!

I think moving TextDiagnosticsPrinter to Basic is much better than making Format depend on Frontend. If you just want to fix your crash and be done with it, then doing that (and adding your test) is fine.

I think the best fix would be to change Basic to never emit diagnostics though. That would also fix this crash, and it'd completely remove clang-format's dependency on the huge array with all of clang's diag, which would significantly reduce the size of clang-format (iirc it'd cut it in half or something). This would need some reorganizing -- Basic would have to call some callback on errors instead, and in clang these callbacks would emit normal diags but in clang-format they'd do something else. If you wanted to look into that, that'd be amazing :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90121/new/

https://reviews.llvm.org/D90121



More information about the cfe-commits mailing list