[PATCH] D146875: [clang-tidy] Fix example provided by add_new_check.py

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 23:12:25 PDT 2023


carlosgalvezp added a comment.

Thanks for digging into this! It looks a bit strange to me:

> Usually developers have to preview a code diff (before vs after apply the fix) to understand what the fix does before applying a fix.

This is not quite true - clang-tidy displays the fix it hint when running it, even if it's not a note. As a human you don't need to apply fixes and then run a diff to understand what the change is about.

  source>:1:9: warning: C-style casts are discouraged; use static_cast [google-readability-casting]
  int x = (int) 1.2F;
          ^~~~~~
          static_cast<int>( )

The patch also said:

> will add implementations for existing checks in the future

Which didn't actually happen, the vast majority of checks do not attach fix it hints to notes.

Since that comment is 4 years old, perhaps is just obsolete?

I think easiest is to go for Option A) - this is how we normally write checks nowadays. Maybe the discussion about removing support for `--fix-notes` can be done in an RFC?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146875



More information about the cfe-commits mailing list