-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Clang] unrecognized html tag causing undesirable comment lexing #152944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-clang Author: None (mdenson) ChangesSimple fix for this particular html tag. A more complete solution should be implemented.
Fixes 32680 Full diff: https://github.com/llvm/llvm-project/pull/152944.diff 2 Files Affected:
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change needs a release note.
Please add an entry to clang/docs/ReleaseNotes.rst
in the section the most adapted to the change, and referencing any Github issue this change fixes. Thanks!
clang/test/AST/ast-dump-comment.cpp
Outdated
// CHECK-NEXT: ParagraphComment | ||
// CHECK: HTMLStartTagComment{{.*}} Name="summary" | ||
// CHECK-NEXT: TextComment{{.*}} Text="Short summary" | ||
// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="summary" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing line break
Added newline and updated release note. I also added, what I thought might be some other reasonable tags:
I can back those out if needed. I didn't write tests for each individually, but I can if needed. |
let me know if you want the extra changes backed out. otherwise, you will need to merge it since i don't have access. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The html tag updates looks good to me - tags are correctly described.
There should be tests for each tag however.
As @cor3ntin has reviewed previously, I'd like his sign off - but as a question to him: do we expect tests for invalid/unclosed tags? my default is to want such tests but that's entirely due to my former work :D
sorry guys, doing too many things at once. just that last commit is mine. can you fix that for me? |
I think easiest path is to force push the pre-mass-commit push as this branch |
I'm sure there's something you can do like But I'm a garbage git user so I would do: git checkout cb7e5ab58315e15eec03818161de1d71a41730da
git branch -D mdenson:issue-32680
git checkout -b mdenson:issue-32680
git push --force --set-upstream <your remote> mdenson:issue-32680 [edit: and probably cherry-pick the commits after 1666c0de52c58e5c3a21f086469a6ebad0ea046d] |
i'm not git expert, but i think that is right |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks!
@mdenson Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/10886 Here is the relevant piece of the build log for the reference
|
Simple fix for this particular html tag. A more complete solution should be implemented.
Fixes #32680