(original) (raw)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index e23b7a1267ac2..cecc5696cb95f 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -222,6 +222,7 @@ Bug Fixes to AST Handling - Fix incorrect name qualifiers applied to alias CTAD. (#GH136624) - Fixed ElaboratedTypes appearing within NestedNameSpecifier, which was not a legal representation. This is fixed because ElaboratedTypes don't exist anymore. (#GH43179) (#GH68670) (#GH92757) +- Fix unrecognized html tag causing undesirable comment lexing (#GH152944) - Fix comment lexing of special command names (#GH152943) Miscellaneous Bug Fixes diff --git a/clang/include/clang/AST/CommentHTMLTags.td b/clang/include/clang/AST/CommentHTMLTags.td index a1ce8c6da96c0..9b89bc0c811fc 100644 --- a/clang/include/clang/AST/CommentHTMLTags.td +++ b/clang/include/clang/AST/CommentHTMLTags.td @@ -51,6 +51,11 @@ 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">; +def Details : Tag<"details">; +def Mark : Tag<"mark">; +def Figure : Tag<"figure">; +def FigCaption : Tag<"figcaption">; // 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 b67f79916d968..b5dbe2e317d8c 100644 --- a/clang/test/AST/ast-dump-comment.cpp +++ b/clang/test/AST/ast-dump-comment.cpp @@ -132,8 +132,50 @@ void Test_TemplatedFunctionVariadic(int arg, ...); // CHECK-NEXT: ParagraphComment // CHECK-NEXT: TextComment{{.*}} Text=" More arguments" +/// \param[out] Aaa Short 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" + /// \thread_safe test for underscore in special command int Test_UnderscoreInSpecialCommand; // CHECK: VarDecl{{.*}}Test_UnderscoreInSpecialCommand 'int' // CHECK: InlineCommandComment{{.*}} Name="thread_safe" RenderNormal // CHECK-NEXT: TextComment{{.*}} Text=" test for underscore in special command" + +/// +/// +/// Summary +/// +///
Details
+/// +/// +/// Some highlighting+/// +///
+///
+///
Figure 1
+///
+int Test_AdditionalHTMLTags(int Aaa); +// CHECK: FunctionDecl{{.*}}Test_AdditionalHTMLTags 'int (int)' +// CHECK: HTMLStartTagComment{{.*}} Name="details" +// CHECK: HTMLStartTagComment{{.*}} Name="summary" +// CHECK-NEXT: TextComment{{.*}} Text=" Summary" +// CHECK: HTMLEndTagComment{{.*}} Name="summary" +// CHECK: HTMLStartTagComment{{.*}} Name="p" +// CHECK-NEXT: TextComment{{.*}} Text="Details" +// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="p" +// CHECK: HTMLEndTagComment{{.*}} Name="details" +// CHECK: HTMLStartTagComment{{.*}} Name="mark" +// CHECK-NEXT: TextComment{{.*}} Text="highlighting" +// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="mark" +// CHECK: HTMLStartTagComment{{.*}} Name="figure" +// CHECK: HTMLStartTagComment{{.*}} Name="img" Attrs: "src="pic.jpg" +// CHECK: HTMLStartTagComment{{.*}} Name="figcaption" +// CHECK-NEXT: TextComment{{.*}} Text="Figure 1" +// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="figcaption" +// CHECK: HTMLEndTagComment{{.*}} Name="figure"