https://github.com/danielcm585 updated 
https://github.com/llvm/llvm-project/pull/198249

>From 4dc6baf808491e1fa8c2ebc4839de404436d2593 Mon Sep 17 00:00:00 2001
From: danielcm585 <[email protected]>
Date: Mon, 18 May 2026 16:07:34 +0800
Subject: [PATCH] [clangd] Fix remark diagnostics without a prior main
 diagnostic

---
 clang-tools-extra/clangd/Diagnostics.cpp                | 4 +---
 clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp | 5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clangd/Diagnostics.cpp 
b/clang-tools-extra/clangd/Diagnostics.cpp
index d0baf0224a18e..c2b86c3bfca2b 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -236,9 +236,7 @@ bool tryMoveToMainFile(Diag &D, FullSourceLoc DiagLoc) {
   return true;
 }
 
-bool isNote(DiagnosticsEngine::Level L) {
-  return L == DiagnosticsEngine::Note || L == DiagnosticsEngine::Remark;
-}
+bool isNote(DiagnosticsEngine::Level L) { return L == DiagnosticsEngine::Note; 
}
 
 llvm::StringRef diagLeveltoString(DiagnosticsEngine::Level Lvl) {
   switch (Lvl) {
diff --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp 
b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
index 4258f7faf34fd..81349320118a4 100644
--- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -1168,6 +1168,11 @@ TEST(DiagnosticsTest, PragmaSystemHeader) {
   EXPECT_THAT(TU.build().getDiagnostics(), IsEmpty());
 }
 
+TEST(DiagnosticsTest, PragmaDebugSlocUsage) {
+  auto TU = TestTU::withCode("#pragma clang __debug sloc_usage\n");
+  (void)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.

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to