[PATCH] D113848: [clang-tidy][NFC] Refactor ClangTidyDiagnosticConsumer files

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 15 01:34:39 PST 2021


carlosgalvezp added a comment.

> What is the motivation behind the change?

The motivation is cleaning the file to make it easier to find things. As a n00b to clang-tidy I find it a bit hard to navigate the code and find the different classes - they are not where I expect them to be. The `ClangTidyContext` is a core class used in other places than just `DiagnosticConsumer`, so I think it makes sense to keep it on it's own file so it's easy to find. For example:

  ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context);

It's unintuitive to have to import the `DiagnosticConsumer` to get the `Context`

In general I think it's a good principle to keep a 1:1 mapping between public classes and files. Naturally, internal helper classes can be kept in the same file as the "main" class. This brings build-time improvements as well but I'd say they are negligible.

Let me know if you agree, otherwise I can of course drop this :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113848



More information about the cfe-commits mailing list