https://github.com/TPPPP72 updated 
https://github.com/llvm/llvm-project/pull/183274

>From 729ced162b23dc967cd528af16a704d9f98ecad1 Mon Sep 17 00:00:00 2001
From: TPPPP <[email protected]>
Date: Wed, 25 Feb 2026 20:56:53 +0800
Subject: [PATCH] [clang] Fix crash when parsing documentation comments with
 invalid declarations

---
 clang/lib/AST/RawCommentList.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/clang/lib/AST/RawCommentList.cpp b/clang/lib/AST/RawCommentList.cpp
index 3f9edc75311d4..91e7187e43581 100644
--- a/clang/lib/AST/RawCommentList.cpp
+++ b/clang/lib/AST/RawCommentList.cpp
@@ -202,6 +202,11 @@ const char *RawComment::extractBriefText(const ASTContext 
&Context) const {
 comments::FullComment *RawComment::parse(const ASTContext &Context,
                                          const Preprocessor *PP,
                                          const Decl *D) const {
+  // If the associated declaration is invalid, do not proceed with semantic
+  // analysis.
+  if (D && D->isInvalidDecl())
+    return nullptr;
+
   // Lazily initialize RawText using the accessor before using it.
   (void)getRawText(Context.getSourceManager());
 

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

Reply via email to