[PATCH] D13166: Create modernize-make-unique check.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 25 10:15:04 PDT 2015

klimek added a comment.

This is definitely a useful check to have in modernize.

Comment at: clang-tidy/modernize/MakeUniqueCheck.cpp:25-27
@@ +24,5 @@
+/// \brief Returns the length of the token that goes since the beggining of the
+/// constructor call until the '<' of the template. This token should either be
+/// 'unique_ptr' or 'std::unique_ptr'. In any other case, it returns 0.
+static int getTokenLength(SourceLocation TokenStart, const SourceManager &SM,
How can that ever return 0 if you have matchesName("::std::unique_ptr") below?

Comment at: clang-tidy/modernize/MakeUniqueCheck.cpp:51
@@ +50,3 @@
+            cxxConstructExpr(
+                hasType(hasCanonicalType(
+                    hasDeclaration(classTemplateSpecializationDecl(
Why do we need the hasCanonicalType?


More information about the cfe-commits mailing list