Suggests switching the initialization pattern of absl::Cleanup instances from the factory function to class template argument deduction (CTAD) in C++17 and higher.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Nice!
clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.cpp | ||
---|---|---|
20 | ||
47–50 | nit: move this inline into the class declaration. Serves as documentation for the class then as well (in that a reader can look in the header and see the target language). | |
clang-tools-extra/clang-tidy/abseil/CleanupCtadCheck.h | ||
21 | ||
clang-tools-extra/test/clang-tidy/checkers/abseil-cleanup-ctad.cpp | ||
8–21 | Since the tests depend on the mock of the Cleanup declaration, have you run this on real code examples to double-check that it works as expected? Sometimes the divergence means real code can have unexpected implicit nodes that subtly impact the results, so it's always good to verify the mocks themselves in some way. | |
42 | nit: this subtle, i'd add a comment pointing out the parens. | |
43 | Here and below: you can truncate to 80 chars, any repeated message. We typically only check the whole message for the first appearance. |
Address nits and update the absl::Cleanup stub to be accurate with the real interface (with associated changes to the AST matcher)