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

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

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

diff --git a/clang/lib/AST/RawCommentList.cpp b/clang/lib/AST/RawCommentList.cpp
index 3f9edc75311d4..26ebe8f0fb10d 100644
--- a/clang/lib/AST/RawCommentList.cpp
+++ b/clang/lib/AST/RawCommentList.cpp
@@ -202,6 +202,10 @@ 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