Skip to content

Commit

Permalink
[clang-tidy][NFC] Fix cppcoreguidelines-missing-std-forward findings
Browse files Browse the repository at this point in the history
Fix issues found by clang-tidy in clang-tidy source directory.
  • Loading branch information
PiotrZSL committed Aug 27, 2023
1 parent 857f532 commit 26078f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ struct MixData {
return *this;
}

template <class F> MixData withCommonTypeTransformed(F &&Func) const {
template <typename F> MixData withCommonTypeTransformed(const F &Func) const {
if (CommonType.isNull())
return *this;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AST_MATCHER(CXXRecordDecl, hasDefaultConstructor) {
// Iterate over all the fields in a record type, both direct and indirect (e.g.
// if the record contains an anonymous struct).
template <typename T, typename Func>
void forEachField(const RecordDecl &Record, const T &Fields, Func &&Fn) {
void forEachField(const RecordDecl &Record, const T &Fields, const Func &Fn) {
for (const FieldDecl *F : Fields) {
if (F->isAnonymousStructOrUnion()) {
if (const CXXRecordDecl *R = F->getType()->getAsCXXRecordDecl())
Expand All @@ -44,7 +44,7 @@ void forEachField(const RecordDecl &Record, const T &Fields, Func &&Fn) {

template <typename T, typename Func>
void forEachFieldWithFilter(const RecordDecl &Record, const T &Fields,
bool &AnyMemberHasInitPerUnion, Func &&Fn) {
bool &AnyMemberHasInitPerUnion, const Func &Fn) {
for (const FieldDecl *F : Fields) {
if (F->isAnonymousStructOrUnion()) {
if (const CXXRecordDecl *R = F->getType()->getAsCXXRecordDecl()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ getRepresentation(const std::vector<llvm::StringRef> &Config,

template <typename T>
static bool isAnyOperatorEnabled(const std::vector<llvm::StringRef> &Config,
T &&Operators) {
const T &Operators) {
for (const auto &[traditional, alternative] : Operators) {
if (!getRepresentation(Config, traditional, alternative).empty())
return true;
Expand Down

0 comments on commit 26078f3

Please sign in to comment.