[PATCH] D43766: [clang-tidy][modernize-make-unique] Checks c++14 flag before using std::make_unique

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 1 10:03:27 PST 2018


aaron.ballman added inline comments.


================
Comment at: clang-tidy/modernize/MakeUniqueCheck.cpp:21
+    : MakeSmartPtrCheck(Name, Context, "std::make_unique"),
+      MinimumLanguageVersion(Options.get("MakeUniqueLanguageVersion",
+                                         getDefaultMinimumLanguageVersion())) {}
----------------
alexfh wrote:
> ftingaud wrote:
> > aaron.ballman wrote:
> > > Why is this is a user-facing option?
> > > 
> > > If it needs to be a user-facing option, you also need to implement an override for `storeOptions()` as well.
> > As the rule was very customizable, I also made the c++ version customizable. But the option is only useful if a user has a custom make_unique that needs c++14 (uses std::make_unique internally) and multiple versions of C++ in their codeline. I agree this is a rather specific usecase. I can remove it and make the code simpler if it is your recommendation.
> > if a user has a custom make_unique that needs c++14
> 
> The only reason to have a custom make_unique that I know is to workaround the absence of std::make_unique in c++11. So this looks like a not very useful case to support.
Agreed, I'd drop it.


https://reviews.llvm.org/D43766





More information about the cfe-commits mailing list