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

Dave Bartolomeo via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 06:17:33 PDT 2025


================
@@ -360,6 +360,12 @@ getFixIt(const tooling::Diagnostic &Diagnostic, bool AnyFix) {
 
 void ClangTidyDiagnosticConsumer::HandleDiagnostic(
     DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) {
+  assert(InSourceFile ||
+         Info.getLocation()
+             .isInvalid()); // A diagnostic should not be reported outside of a
+                            // BeginSourceFile()/EndSourceFile() pair if it has
+                            // a source location.
----------------
dbartol wrote:

Fixed

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


More information about the cfe-commits mailing list