Skip to content

Conversation

mdenson
Copy link
Contributor

@mdenson mdenson commented Aug 10, 2025

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

Copy link

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 @ followed by their GitHub username.

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.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 10, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 10, 2025

@llvm/pr-subscribers-clang

Author: None (mdenson)

Changes

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 --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

@cor3ntin cor3ntin changed the title ([clang] unrecognized html tag causing undesirable comment lexing.) [lang] unrecognized html tag causing undesirable comment lexing.) Aug 11, 2025
@cor3ntin cor3ntin changed the title [lang] unrecognized html tag causing undesirable comment lexing.) [Clang] unrecognized html tag causing undesirable comment lexing Aug 11, 2025
Copy link
Contributor

@cor3ntin cor3ntin left a 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!

// CHECK-NEXT: ParagraphComment
// CHECK: HTMLStartTagComment{{.*}} Name="summary"
// CHECK-NEXT: TextComment{{.*}} Text="Short summary"
// CHECK-NEXT: HTMLEndTagComment{{.*}} Name="summary"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line break

@mdenson
Copy link
Contributor Author

mdenson commented Aug 14, 2025

Added newline and updated release note.

I also added, what I thought might be some other reasonable tags:

  • details (used with summary)
  • mark (for highlighting)
  • figure and figcaption

I can back those out if needed.

I didn't write tests for each individually, but I can if needed.

@mdenson
Copy link
Contributor Author

mdenson commented Aug 15, 2025

let me know if you want the extra changes backed out. otherwise, you will need to merge it since i don't have access.

Copy link
Contributor

@ojhunt ojhunt left a 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

@mdenson
Copy link
Contributor Author

mdenson commented Aug 16, 2025

sorry guys, doing too many things at once. just that last commit is mine.

can you fix that for me?

@ojhunt
Copy link
Contributor

ojhunt commented Aug 16, 2025

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

@ojhunt
Copy link
Contributor

ojhunt commented Aug 16, 2025

I'm sure there's something you can do like git push --force cb7e5ab58315e15eec03818161de1d71a41730da ...

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]

@mdenson
Copy link
Contributor Author

mdenson commented Aug 16, 2025

i'm not git expert, but i think that is right

Copy link
Contributor

@cor3ntin cor3ntin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

@cor3ntin cor3ntin merged commit 65ffa53 into llvm:main Aug 17, 2025
10 checks passed
Copy link

@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-ci
Copy link
Collaborator

llvm-ci commented Aug 17, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building clang at step 6 "test".

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
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/help/TestHelp.py (190 of 2297)
PASS: lldb-api :: commands/log/basic/TestLogHandlers.py (191 of 2297)
PASS: lldb-api :: commands/log/invalid-args/TestInvalidArgsLog.py (192 of 2297)
PASS: lldb-api :: commands/log/basic/TestLogging.py (193 of 2297)
PASS: lldb-api :: commands/memory/write/TestMemoryWrite.py (194 of 2297)
PASS: lldb-api :: commands/memory/read/TestMemoryRead.py (195 of 2297)
PASS: lldb-api :: commands/platform/basic/TestPlatformPython.py (196 of 2297)
PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (197 of 2297)
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (198 of 2297)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (199 of 2297)
FAIL: lldb-api :: commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py (200 of 2297)
******************** TEST 'lldb-api :: commands/platform/launchgdbserver/TestPlatformLaunchGDBServer.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type Release --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\platform\launchgdbserver -p TestPlatformLaunchGDBServer.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 65ffa53cb70909be4dbedacd9de9de0725161592)
  clang revision 65ffa53cb70909be4dbedacd9de9de0725161592
  llvm revision 65ffa53cb70909be4dbedacd9de9de0725161592
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
UNSUPPORTED: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_error (TestPlatformLaunchGDBServer.TestPlatformProcessLaunchGDBServer.test_launch_error) (requires one of linux) 

lldb-server exiting...

FAIL: LLDB (C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: test_launch_with_unusual_process_name (TestPlatformLaunchGDBServer.TestPlatformProcessLaunchGDBServer.test_launch_with_unusual_process_name)

======================================================================

FAIL: test_launch_with_unusual_process_name (TestPlatformLaunchGDBServer.TestPlatformProcessLaunchGDBServer.test_launch_with_unusual_process_name)

   Test that lldb-server can launch a debug session when running under an

----------------------------------------------------------------------

Traceback (most recent call last):

  File "C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\platform\launchgdbserver\TestPlatformLaunchGDBServer.py", line 83, in test_launch_with_unusual_process_name

    self.expect("run", substrs=["exited with status = 0"])


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clang comment representation bug

5 participants