[clang] ([clang] unrecognized html tag causing undesirable comment lexing.) (PR #152944)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 10 15:13:04 PDT 2025
https://github.com/mdenson created https://github.com/llvm/llvm-project/pull/152944
Simple fix for this particular html tag. A more complete solution should be implemented.
1. Add all html tags to table so they are recognized. Some input on what is desirable/safe would be appreciated
2. Change the lex strategy to deal with this in a different manner
Fixes 32680
>From 9cfd8978eca58a584a3fc09fe3e839c44d5b3205 Mon Sep 17 00:00:00 2001
From: Brock Denson <brock.denson at virscient.com>
Date: Thu, 7 Aug 2025 10:09:25 -0500
Subject: [PATCH] [clang] unrecognized html tag causing undesirable comment
lexing. fixes #32680
---
clang/include/clang/AST/CommentHTMLTags.td | 1 +
clang/test/AST/ast-dump-comment.cpp | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/clang/include/clang/AST/CommentHTMLTags.td b/clang/include/clang/AST/CommentHTMLTags.td
index a1ce8c6da96c0..31bfd306867b7 100644
--- a/clang/include/clang/AST/CommentHTMLTags.td
+++ b/clang/include/clang/AST/CommentHTMLTags.td
@@ -51,6 +51,7 @@ def Col : Tag<"col"> { let EndTagForbidden = 1; }
def Tr : Tag<"tr"> { let EndTagOptional = 1; }
def Th : Tag<"th"> { let EndTagOptional = 1; }
def Td : Tag<"td"> { let EndTagOptional = 1; }
+def Summary : Tag<"summary">;
// Define a list of attributes that are not safe to pass through to HTML
// output if the input is untrusted.
diff --git a/clang/test/AST/ast-dump-comment.cpp b/clang/test/AST/ast-dump-comment.cpp
index 40c3edb62821b..f4cae32cfa732 100644
--- a/clang/test/AST/ast-dump-comment.cpp
+++ b/clang/test/AST/ast-dump-comment.cpp
@@ -131,3 +131,12 @@ void Test_TemplatedFunctionVariadic(int arg, ...);
// CHECK: ParamCommandComment{{.*}} [in] implicitly Param="..."
// CHECK-NEXT: ParagraphComment
// CHECK-NEXT: TextComment{{.*}} Text=" More arguments"
+
+/// \param[out] Aaa <summary>Short summary</summary>
+int Test_HTMLSummaryTag(int Aaa);
+// CHECK: FunctionDecl{{.*}}Test_HTMLSummaryTag
+// CHECK: ParamCommandComment{{.*}} [out] explicitly Param="Aaa"
+// CHECK-NEXT: ParagraphComment
+// CHECK: HTMLStartTagComment{{.*}} Name="summary"
+// CHECK-NEXT: TextComment{{.*}} Text="Short summary"
+// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="summary"
\ No newline at end of file
More information about the cfe-commits
mailing list