Comment parsing: Don't recognize commands in single-line double quotation
authorAaron Puchert <aaron.puchert@sap.com>
Fri, 14 Jan 2022 21:45:59 +0000 (22:45 +0100)
committerAaron Puchert <aaron.puchert@sap.com>
Fri, 14 Jan 2022 21:46:07 +0000 (22:46 +0100)
commit9f0fa6544012ed8f7b6b3d72fce6535bf4430e40
treec5d24ac3eab41a987f4c056a5146813a8a1c1bad
parentbd0a970f5341f9981a9ad33fdfda99f8ff7348b3
Comment parsing: Don't recognize commands in single-line double quotation

This is consistent with the behavior of Doxygen, and allows users to
write strings with C escapes or document input/output formats containing
special characters (@ or \) without escaping them, which might be
confusing. For example, if a function wants to document its expected
input format as "user@host" it doesn't have to write user\@host instead,
which would look right in the documentation but confusing in the code.
Now users can just use double quotes (which they might do anyway).

This fixes a lot of false positives of -Wdocumentation-unknown-command,
but it could also fix issues with -Wdocumentation if the text triggers
an actual command.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D116190
clang/include/clang/AST/CommentLexer.h
clang/lib/AST/CommentLexer.cpp
clang/test/Sema/warn-documentation-unknown-command.cpp
clang/test/Sema/warn-documentation.cpp