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

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 14 08:28:33 PDT 2018


alexfh removed a reviewer: Prazek. alexfh added 1 blocking reviewer(s): hokein.
alexfh added a comment.

A couple of nits.



================
Comment at: clang-tidy/modernize/MakeUniqueCheck.cpp:42-44
+  if (RequireCPlusPlus14)
+    return LangOpts.CPlusPlus14;
+  return LangOpts.CPlusPlus11;
----------------
nit: Use ternary operator?


================
Comment at: test/clang-tidy/modernize-make-unique-cxx11.cpp:7
+
+int main() {
+  auto my_ptr = std::unique_ptr<int>(new int(1));
----------------
No need to define `int main()` in the test. It can also become confusing for the readers of the code. Please change this to `void f()` or something like that and remove the return statement.

Same below.


https://reviews.llvm.org/D43766





More information about the cfe-commits mailing list