[PATCH] D131623: [clang-tidy] Improve modernize-use-emplace check
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 08:03:00 PDT 2022
njames93 added a comment.
Just a general drive by comment here and doesn't affect this patch.
This specifying containers logic is a little verbose, There may be a case to deprecate most of these options and just detect containers with an equivalent emplace* method at runtime.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:296-310
+ auto Diag = [&]() {
+ if (PushBackCall) {
+ return diag(Call->getExprLoc(), "use emplace_back instead of push_back");
+ }
+ if (PushCall) {
+ return diag(Call->getExprLoc(), "use emplace instead of push");
+ }
----------------
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:320
}
+ if (PushCall) {
+ const char *EmplacePrefix = MakeCall ? "emplace" : "emplace(";
----------------
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp:325
+ }
+ if (PushFrontCall) {
+ const char *EmplacePrefix = MakeCall ? "emplace_front" : "emplace_front(";
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131623/new/
https://reviews.llvm.org/D131623
More information about the cfe-commits
mailing list