llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Daniel Christian Mandolang (danielcm585) <details> <summary>Changes</summary> This fixes #<!-- -->197758 --- Full diff: https://github.com/llvm/llvm-project/pull/198249.diff 2 Files Affected: - (modified) clang-tools-extra/clangd/Diagnostics.cpp (+1-1) - (modified) clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp (+9) ``````````diff diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp index d0baf0224a18e..f6ead2e677db2 100644 --- a/clang-tools-extra/clangd/Diagnostics.cpp +++ b/clang-tools-extra/clangd/Diagnostics.cpp @@ -237,7 +237,7 @@ bool tryMoveToMainFile(Diag &D, FullSourceLoc DiagLoc) { } bool isNote(DiagnosticsEngine::Level L) { - return L == DiagnosticsEngine::Note || L == DiagnosticsEngine::Remark; + return L == DiagnosticsEngine::Note; } llvm::StringRef diagLeveltoString(DiagnosticsEngine::Level Lvl) { diff --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp index 4258f7faf34fd..62fd3a502ab7b 100644 --- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -1168,6 +1168,15 @@ TEST(DiagnosticsTest, PragmaSystemHeader) { EXPECT_THAT(TU.build().getDiagnostics(), IsEmpty()); } +// Regression test for https://github.com/llvm/llvm-project/issues/197681 +// #pragma clang __debug sloc_usage emits a remark followed by notes. +// StoreDiags must not crash when a remark arrives without a prior main diag. +TEST(DiagnosticsTest, PragmaDebugSlocUsage) { + auto TU = TestTU::withCode("#pragma clang __debug sloc_usage\n"); + // Just verify we don't crash (the assertion was firing before the fix). + TU.build().getDiagnostics(); +} + TEST(ClangdTest, MSAsm) { // Parsing MS assembly tries to use the target MCAsmInfo, which we don't link. // We used to crash here. Now clang emits a diagnostic, which we filter out. `````````` </details> https://github.com/llvm/llvm-project/pull/198249 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
