[PATCH] D107294: [clang-tidy] adds warning to suggest users replace symbols with words

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 5 11:07:08 PDT 2021


cjdb marked an inline comment as done.
cjdb added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/AlternativeTokensCheck.h:20-21
+namespace readability {
+/// Flags uses of symbol-based bitwise and logical operators.
+class AlternativeTokensCheck : public ClangTidyCheck {
+public:
----------------
whisperity wrote:
> Following from gone thread due to file rename.
> 
> >>! In D107294#2923102, @cjdb wrote:
> > Not sure I'm following you here: are you suggesting I put the contents of my `rst` file in a comment here?
> 
> Not the entire //RST//, but the one-sentence or first-paragraph "pitch". For example, let's see `bugprone-branch-clone`'s class's doc-comment:
> 
> ```
> /// A check for detecting if/else if/else chains where two or more branches are
> /// Type I clones of each other (that is, they contain identical code), for
> /// detecting switch statements where two or more consecutive branches are
> /// Type I clones of each other, and for detecting conditional operators where
> /// the true and false expressions are Type I clones of each other.
> ///
> /// For the user-facing documentation see:
> /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-branch-clone.html
> class BranchCloneCheck : public ClangTidyCheck {
> ```
> 
> Or another one selected randomly, `performance-no-automatic-move`:
> 
> ```
> /// Finds local variables that cannot be automatically moved due to constness.
> ///
> /// For the user-facing documentation see:
> /// http://clang.llvm.org/extra/clang-tidy/checks/performance-no-automatic-move.html
> class NoAutomaticMoveCheck : public ClangTidyCheck {
> ```
> 
> So there is a one-paragraph summary of the check itself (it could be shorter than here...), and there is a text that's generated from a template (I think `add-new-check.py` sets the new check's files as such when you run it), which basically just links the upstream official website render of your check's documentation HTML.
Thanks for the comprehensive examples!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107294/new/

https://reviews.llvm.org/D107294



More information about the cfe-commits mailing list