[clang] [clang-tools-extra] [clang-tidy] EndSourceFile() for preprocessor before diagnostic client (PR #145784)

Jan Korous via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 2 12:13:11 PDT 2025


================
@@ -292,6 +292,21 @@ class ClangTidyDiagnosticConsumer : public DiagnosticConsumer {
   void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
                         const Diagnostic &Info) override;
 
+  void BeginSourceFile(const LangOptions &LangOpts,
+                       const Preprocessor *PP = nullptr) override {
+    DiagnosticConsumer::BeginSourceFile(LangOpts, PP);
+
+    assert(!InSourceFile);
----------------
jkorous-apple wrote:

I assume this refers to the main input source file only, and has nothing to do with included files. Is that right?

https://github.com/llvm/llvm-project/pull/145784


More information about the cfe-commits mailing list