[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:49 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (mdenson)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/152944.diff
2 Files Affected:
- (modified) clang/include/clang/AST/CommentHTMLTags.td (+1)
- (modified) clang/test/AST/ast-dump-comment.cpp (+9)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/152944
More information about the cfe-commits
mailing list