[PATCH] D95403: [clang-tidy][analyzer][WIP] Clang-tidy reverse integration into Static Analyzer.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 28 23:02:45 PST 2021


NoQ added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:54-60
+#include "../../clang-tools-extra/clang-tidy/ClangTidyCheck.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyForceLinker.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyModule.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyOptions.h"
+#include "../../clang-tools-extra/clang-tidy/ClangTidyProfiling.h"
----------------
alexfh wrote:
> Isn't this a layering violation, since clang-tidy depends on clangStaticAnalyzerCore and clangStaticAnalyzerFrontend?
Yes, absolutely.

That said, the only purpose of clang-tidy's dependency on libStaticAnalyzer* is integration of static analyzer into clang tidy which is definitely not something we want to enable when we're baking clang-tidy back into clang. It never makes sense to run static analyzer through clang-tidy integration into static analyzer.

So ideally these two dependencies are temporally separated. I could make these dependencies mutually exclusive by making the upcoming option of baking clang-tidy into clang explicitly incompatible with `CLANG_TIDY_ENABLE_STATIC_ANALYZER`.

But if we want to support building both clang-tidy with static analyzer and static analyzer with clang-tidy from the same sources into the same build directory, that'll probably involve either building two variants of clang-tidy (one with static analyzer for standalone clang-tidy binary and one without to use inside clang binary only) or two variants of static analyzer (one with clang-tidy for the clang binary and one without to use inside clang-tidy binary only).

Do you have any preference on how should i untangle this?


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

https://reviews.llvm.org/D95403



More information about the cfe-commits mailing list