This check look for cases when inserting new element into an STL
container, but the element is constructed temporarily.
It changes it to call of emplace_back
Differential D20964
[clang-tidy] Add modernize-use-emplace Prazek on Jun 3 2016, 7:45 AM. Authored by
Details This check look for cases when inserting new element into an STL It changes it to call of emplace_back
Diff Detail
Event Timeline
Comment Actions Could you describe in more detail (ideally in the original patch review summary/description) what this transformation does? Under what conditions does it suggest emplace, etc.
Comment Actions I think will be good idea to try this check with LLVM STL too.
Comment Actions No, I meant to build example with -stdlib=libc++, -lc++, -lc++abi. Just to make sure, that hasName() is proper matcher. Comment Actions I runned it on llvm codebase with libstdc++ and it worked perfectly. I don't think there should be any change with libc++. I will run it only on small with libc++, because it will take too much time to compile whole llvm again. Comment Actions There is alternative implementation in D21185. Will be good idea to make one which take the best from both :-) Comment Actions @Eugene.Zelenko thanks for pointing this out, I had totally missed this patch! Once we get this reviewed I'm willing to abandon my version. Some comments inline --
Comment Actions A few comments.
Comment Actions Changes after running og llvm code base. Adding llvm::SmallVector was a good idea, because it has fired for much more cases and I have found 3 other bugs. Comment Actions I have tested it on llvm code base and I have found many, many corner cases. I see that your check have better fixit messages (it only prints change of push_back -> emplace_back). I guess the best idea is to push this check, and then if you would like, change it so it would also have nice fixit messages Comment Actions
Comment Actions Thank you Samuel, that it is valuable review! should we revert this patch? It seems that those bugs are not so critical (at least on llvm http://reviews.llvm.org/D21507). |
runaway qoute