[clang-tools-extra] [NFC][clang-tidy]refactor isAssignmentToMemberOf in PreferMemberInitializerCheck (PR #71006)
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 2 02:46:05 PDT 2023
================
@@ -216,11 +216,12 @@ void PreferMemberInitializerCheck::check(
return;
}
- const FieldDecl *Field = nullptr;
- const Expr *InitValue = nullptr;
- std::tie(Field, InitValue) = isAssignmentToMemberOf(Class, S, Ctor);
- if (!Field)
+ std::optional<std::pair<const FieldDecl *, const Expr *>>
+ AssignmentToMember = isAssignmentToMemberOf(Class, S, Ctor);
+ if (!AssignmentToMember)
continue;
+ const FieldDecl *Field = AssignmentToMember.value().first;
----------------
PiotrZSL wrote:
you can use `->` operator here... No ned for value().
https://github.com/llvm/llvm-project/pull/71006
More information about the cfe-commits
mailing list