This is an archive of the discontinued LLVM Phabricator instance.

Comment parsing: Don't recognize commands in single-line double quotation
ClosedPublic

Authored by aaronpuchert on Dec 22 2021, 2:26 PM.

Details

Summary

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.

Diff Detail

Event Timeline

aaronpuchert requested review of this revision.Dec 22 2021, 2:26 PM
aaronpuchert created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2021, 2:26 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
gribozavr2 added inline comments.Jan 12 2022, 10:14 AM
clang/lib/AST/CommentLexer.cpp
278

I'd suggest refactoring to a while (true) if you don't mind.

290

Does Doxygen understand escaped quotes?

/// "@hello\"@hello"
aaronpuchert marked an inline comment as done.Jan 14 2022, 5:10 AM
aaronpuchert added inline comments.
clang/lib/AST/CommentLexer.cpp
278

I was imitating lexVerbatimBlockFirstLine, but I don't mind either way.

290

Vim syntax highlighting suggests it does, but at least my version actually doesn't: "@c a \" @c b" is translated to "@c a \" <code>b"</code>. So the escaped quote seems to end the quotation.

485

This is what I was imitating.

aaronpuchert marked an inline comment as done.Jan 14 2022, 8:58 AM
gribozavr2 accepted this revision.Jan 14 2022, 9:12 AM
gribozavr2 added inline comments.
clang/lib/AST/CommentLexer.cpp
278

I see. No worries then.

290

Got it, thanks for checking!

This revision is now accepted and ready to land.Jan 14 2022, 9:12 AM
This revision was landed with ongoing or failed builds.Jan 14 2022, 1:48 PM
This revision was automatically updated to reflect the committed changes.
aaronpuchert marked 3 inline comments as done.