[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
Wed Feb 28 11:42:51 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())) {}
----------------
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.


================
Comment at: clang-tidy/modernize/MakeUniqueCheck.cpp:25
+const std::string MakeUniqueCheck::getDefaultMinimumLanguageVersion() const {
+  return Options.get("MakeSmartPtrFunction", "").empty() ? "c++14" : "c++11";
+}
----------------
What is this option? Why is this returning a string literal rather than something less error-prone like an enumeration?


https://reviews.llvm.org/D43766





More information about the cfe-commits mailing list