[clang-tools-extra] [clangd] Do not promote non-fatal diagnostics from headers to caller locations in main file (PR #223860)

Aleksandr Platonov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 23:00:34 PDT 2026


================
@@ -465,6 +465,30 @@ TEST(DiagnosticTest, TemplatesInHeaders) {
                                       "'Derived<int>' requested here")))));
 }
 
+// Verify that non-fatal warnings originating from included headers are not
+// promoted and shown in the main file, as this would clutter the user's
+// diagnostics with warnings from code they didn't write.
----------------
ArcsinX wrote:

The code in this test shows why diagnostic can't be dropped.
We have a templated code in header, which is completely fine if a caller use it right (e.g. f(1)), but we call it incorrectly (pass double instead of int) and we MUST shown diagnostic here, so dropping it is not right

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


More information about the cfe-commits mailing list