This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] - Introduce abseil-prefixed-thread-annotations check.
AcceptedPublic

Authored by mbonadei on Jun 28 2019, 6:34 AM.

Details

Summary

The new clang-tidy check "abseil-prefixed-thread-annotations" checks for usages of deprecated Abseil thread annotation macros and migrates them to the new macros that are prefixed with ABSL_.

Diff Detail

Event Timeline

mbonadei created this revision.Jun 28 2019, 6:34 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 28 2019, 6:34 AM
gribozavr accepted this revision.Jun 28 2019, 6:43 AM
gribozavr added a reviewer: gribozavr.
gribozavr added a subscriber: gribozavr.

Do you have commit access?

clang-tools-extra/clang-tidy/abseil/PrefixedThreadAnnotationsCheck.cpp
43

"unprefixed" is not something that the user cares about. Try wording it the message around deprecation. Describing the fix-it in the message is also a good idea.

"annotations without the 'ABSL_' prefix are deprecated; use the new name instead"

This revision is now accepted and ready to land.Jun 28 2019, 6:43 AM
gribozavr added inline comments.Jun 28 2019, 6:45 AM
clang-tools-extra/clang-tidy/abseil/PrefixedThreadAnnotationsCheck.cpp
43

Same suggestion for the check name. WDYT about "DeprecatedThreadAnnotationsCheck"?

I have the same observation as with googletest patch (D62977),
and i'd guess this applies to all these clang-tidy abseil checks (meaning the existing ones are all equally broken):
there is no checking that the new macro actually exists.

lebedev.ri requested changes to this revision.Jun 28 2019, 6:52 AM
lebedev.ri added inline comments.
clang-tools-extra/clang-tidy/abseil/PrefixedThreadAnnotationsCheck.cpp
41

This isn't being tested. What happens if the macro comes from non-abseil header?

This revision now requires changes to proceed.Jun 28 2019, 6:52 AM

(Stuck reviews are bad, but blind stamping is even worse..)

clang-tools-extra/clang-tidy/abseil/PrefixedThreadAnnotationsCheck.cpp
15–16

constexpr StringLiteral ?
shouldn't this be in anonymous namespace, or be static?

37

This isn't correct as per coding style

Eugene.Zelenko added inline comments.
clang-tools-extra/clang-tidy/abseil/PrefixedThreadAnnotationsCheck.cpp
15–16

static, please, anonymous namespaces only for class declarations.

21

Please run Clang-format.

clang-tools-extra/docs/ReleaseNotes.rst
96

Please use double back-ticks for language constructs highlighting.

clang-tools-extra/docs/clang-tidy/checks/abseil-prefixed-thread-annotations.rst
6

Please use sentence from Release Notes instead.

12

Please separate with empty line.

17

Clang-format, please.

lebedev.ri resigned from this revision.Jan 12 2023, 4:42 PM

This review seems to be stuck/dead, consider abandoning if no longer relevant.

This revision is now accepted and ready to land.Jan 12 2023, 4:42 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript