[PATCH] D101471: [clang-tidy] Add proper emplace checks to modernize-use-emplace
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 28 17:18:39 PDT 2021
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:29
+ int Count = 0;
+ for (const auto &Character : FullName) {
+ if (Character == '<') {
----------------
I'm not sure, but probably braces could be elided in `for` and `if else`.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:46
+ } else if (FullNameTrimmedRef.endswith(Pattern) &&
+ FullNameTrimmedRef.drop_back(Pattern.size()).endswith("::")) {
+ return true;
----------------
I'm not sure, but probably braces could be elided.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:57
+ clang::ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
+ if (Node.getNumArgs() == 0) {
+ return false;
----------------
Please elide braces.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:69
+AST_MATCHER(CXXMemberCallExpr, hasSameNumArgsAsDeclNumParams) {
+ if (Node.getMethodDecl()->isFunctionTemplateSpecialization()) {
+ return Node.getNumArgs() == Node.getMethodDecl()
----------------
Please elide braces.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:268
+ if (PushBackCall) {
+ const auto *EmplacePrefix = MakeCall ? "emplace_back" : "emplace_back(";
+ Diag << FixItHint::CreateReplacement(FunctionNameSourceRange,
----------------
It's not yours, but please fix it, since code was affected by your change.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101471/new/
https://reviews.llvm.org/D101471
More information about the cfe-commits
mailing list