[PATCH] D118847: Added early exit for defaulted FunctionDecls.This prevents matching of defaulted comparison operators. fixes llvm#53355
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 9 03:05:45 PST 2022
kbobyrev added a comment.
Mostly LG with few nits. I think it might be able to make it into the 14 release if we cherry-pick into the release branch.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:407
- if (F->getLocation().isInvalid())
+ // operator<=> generates also the AST of e.g. operator==, which is implicit
+ if (F->getLocation().isInvalid() || F->isImplicit())
----------------
nit: probably explains the situation better
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:411
- // Skip functions which return just 'auto'.
- const auto *AT = F->getDeclaredReturnType()->getAs<AutoType>();
- if (AT != nullptr && !AT->isConstrained() &&
- AT->getKeyword() == AutoTypeKeyword::Auto &&
- !hasAnyNestedLocalQualifiers(F->getDeclaredReturnType()))
- return;
+ { // Skip functions which return just 'auto' or are also defaulted operators.
+ const auto *AT = F->getDeclaredReturnType()->getAs<AutoType>();
----------------
This scope seems unnecessary.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118847/new/
https://reviews.llvm.org/D118847
More information about the cfe-commits
mailing list