[PATCH] D20964: [clang-tidy] Add modernize-use-emplace
Stanisław Barzowski via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 3 09:25:17 PDT 2016
sbarzowski added inline comments.
================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:40
@@ +39,3 @@
+ // passed pointer because smart pointer won't be constructed
+ // (and destructed) as in push_back case.
+ auto isCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(
----------------
> Look at tests - the same thing happens when
Yeah. I meant looking for `new` in addition to blacklist.
> Not many custom classes take pointer in constructor.
Obviously depends on codebase, but IMO it's quite common. However usually this classes aren't copy-constructible (or at least shouldn't be) anyway, making it impossible to use push_back, so maybe it's not such a big deal.
> If I will look for const pointers, then I will not be able to pass "abc" into vector<string>.
I wrote explicitly about only **non**-const pointers.
http://reviews.llvm.org/D20964
More information about the cfe-commits
mailing list