[all-commits] [llvm/llvm-project] bd0a97: Comment parsing: Simplify Lexer::skipLineStartingD...

Aaron Puchert via All-commits all-commits at lists.llvm.org
Fri Jan 14 13:48:31 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd0a970f5341f9981a9ad33fdfda99f8ff7348b3
      https://github.com/llvm/llvm-project/commit/bd0a970f5341f9981a9ad33fdfda99f8ff7348b3
  Author: Aaron Puchert <aaron.puchert at sap.com>
  Date:   2022-01-14 (Fri, 14 Jan 2022)

  Changed paths:
    M clang/lib/AST/CommentLexer.cpp

  Log Message:
  -----------
  Comment parsing: Simplify Lexer::skipLineStartingDecorations (NFC)

Inspection of the first character can just be handled by the loop as
well, it does exactly the same thing. Dereferencing the pointer a second
time shouldn't be an issue: the middle end can eliminate that second
read as it's separated from the first only by a pure function call.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D116186


  Commit: 9f0fa6544012ed8f7b6b3d72fce6535bf4430e40
      https://github.com/llvm/llvm-project/commit/9f0fa6544012ed8f7b6b3d72fce6535bf4430e40
  Author: Aaron Puchert <aaron.puchert at sap.com>
  Date:   2022-01-14 (Fri, 14 Jan 2022)

  Changed paths:
    M clang/include/clang/AST/CommentLexer.h
    M clang/lib/AST/CommentLexer.cpp
    M clang/test/Sema/warn-documentation-unknown-command.cpp
    M clang/test/Sema/warn-documentation.cpp

  Log Message:
  -----------
  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 at 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


Compare: https://github.com/llvm/llvm-project/compare/0b442db9f62e...9f0fa6544012


More information about the All-commits mailing list