egorzhdan created this revision. Herald added a project: All. egorzhdan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
This is a valid HTML5 tag. Previously it triggered a Clang error (`HTML start tag prematurely ended, expected attribute name or '>'`) since Clang was treating `/>` as a text token. This was happening because after lexing the closing quote (`"`) the lexer state was reset to "Normal" while the tag was not actually closed yet: `>` was not yet parsed at that point. rdar://91464292 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D132932 Files: clang/lib/AST/CommentLexer.cpp clang/test/Sema/warn-documentation.cpp Index: clang/test/Sema/warn-documentation.cpp =================================================================== --- clang/test/Sema/warn-documentation.cpp +++ clang/test/Sema/warn-documentation.cpp @@ -62,6 +62,21 @@ /// <br></br> int test_html11(int); +/// Aaa bbb<img/> +int test_html_img1(int); + +/// Aaa bbb<img /> +int test_html_img2(int); + +/// Aaa bbb<img src=""> +int test_html_img3(int); + +/// Aaa bbb<img src=""/> +int test_html_img3(int); + +/// Aaa bbb<img src="" /> +int test_html_img4(int); + /// <blockquote>Meow</blockquote> int test_html_nesting1(int); Index: clang/lib/AST/CommentLexer.cpp =================================================================== --- clang/lib/AST/CommentLexer.cpp +++ clang/lib/AST/CommentLexer.cpp @@ -701,7 +701,7 @@ C = *BufferPtr; if (!isHTMLIdentifierStartingCharacter(C) && - C != '=' && C != '\"' && C != '\'' && C != '>') { + C != '=' && C != '\"' && C != '\'' && C != '>' && C != '/') { State = LS_Normal; return; }
Index: clang/test/Sema/warn-documentation.cpp =================================================================== --- clang/test/Sema/warn-documentation.cpp +++ clang/test/Sema/warn-documentation.cpp @@ -62,6 +62,21 @@ /// <br></br> int test_html11(int); +/// Aaa bbb<img/> +int test_html_img1(int); + +/// Aaa bbb<img /> +int test_html_img2(int); + +/// Aaa bbb<img src=""> +int test_html_img3(int); + +/// Aaa bbb<img src=""/> +int test_html_img3(int); + +/// Aaa bbb<img src="" /> +int test_html_img4(int); + /// <blockquote>Meow</blockquote> int test_html_nesting1(int); Index: clang/lib/AST/CommentLexer.cpp =================================================================== --- clang/lib/AST/CommentLexer.cpp +++ clang/lib/AST/CommentLexer.cpp @@ -701,7 +701,7 @@ C = *BufferPtr; if (!isHTMLIdentifierStartingCharacter(C) && - C != '=' && C != '\"' && C != '\'' && C != '>') { + C != '=' && C != '\"' && C != '\'' && C != '>' && C != '/') { State = LS_Normal; return; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits