[PATCH] D20964: [clang-tidy] Add modernize-use-emplace

Piotr Padlewski via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 09:40:03 PDT 2016


Prazek marked 2 inline comments as done.

================
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(
----------------
sbarzowski wrote:
> > 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.
It doesn't matter if it is const or not. Disabling any of them would disable some cases where it would be good.
I have to run it on llvm code base and see what happens


http://reviews.llvm.org/D20964





More information about the cfe-commits mailing list