[PATCH] D50852: [clang-tidy] abseil-auto-make-unique
Zinovy Nis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 18 12:43:58 PDT 2018
zinovy.nis added inline comments.
================
Comment at: clang-tidy/abseil/AutoMakeUniqueCheck.cpp:21
+void AutoMakeUniqueCheck::registerMatchers(MatchFinder* finder) {
+ if (!getLangOpts().CPlusPlus) return;
+
----------------
JonasToth wrote:
> Please clang-format, `return` on next line.
`auto` first appeared in C++11, so you may use `getLangOpts().CPlusPlus11`
And `std::make_unique` is a part of C++14, so even `getLangOpts().CPlusPlus14.
================
Comment at: clang-tidy/abseil/AutoMakeUniqueCheck.cpp:66
+ const auto* var_decl = result.Nodes.getNodeAs<VarDecl>("var_decl");
+ const auto* make_unique_decl =
+ result.Nodes.getNodeAs<FunctionDecl>("make_unique_decl");
----------------
You may move this definition after the next `if`+`return`.
================
Comment at: docs/clang-tidy/checks/abseil-auto-make-unique.rst:10
+
+ std::unique_ptr<Foo> x = MakeUnique<Foo>(...);
+
----------------
`MakeUnique<Foo>`? Maybe `std/abseil::make_unique`?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D50852
More information about the cfe-commits
mailing list