[PATCH] D69435: [clang-tidy] New checker performance-trivially-destructible-check
Anton Bikineev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 14:24:39 PDT 2019
AntonBikineev marked an inline comment as done.
AntonBikineev added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/performance/TriviallyDestructibleCheck.cpp:45
+ isDefaulted(),
+ unless(anyOf(isFirstDecl(), isVirtual(),
+ ofClass(cxxRecordDecl(
----------------
gribozavr2 wrote:
> The "isFirstDecl" part probably will always work, however, it is semantically not really the right predicate to check. What we want to check is where the constructor is declared -- in the class or outside the class, correct? If so, then the matcher should be looking at the DeclContext of the constructor decl.
Thanks for the comment.
> What we want to check is where the constructor is declared -- in the class or outside the class, correct?
I was following the Standard's wording, which says that trivial destructor is not user-provided, where [[ http://eel.is/c++draft/dcl.fct.def.default#def:user-provided | user-provided ]] means
> user-declared and not explicitly defaulted or deleted on its **first declaration**.
Technically, I think both ways should work as C++ doesn't allow more than 2 special function declarations.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69435/new/
https://reviews.llvm.org/D69435
More information about the cfe-commits
mailing list