[PATCH] D55044: [clang-tidy] check for Abseil make_unique

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 12 19:13:53 PST 2018


EricWF marked an inline comment as done.
EricWF added a comment.

I'm not sure how you're building this, but it doesn't link for me. We need to add a dependency on `clangTidyModernizeModule` since we're deriving from its `MakeSmartPtrCheck`.



================
Comment at: clang-tidy/abseil/MakeUniqueCheck.cpp:28
+      recordType(hasDeclaration(classTemplateSpecializationDecl(
+          hasName("::std::unique_ptr"), templateArgumentCountIs(2),
+          hasTemplateArgument(
----------------
Eugene.Zelenko wrote:
> EricWF wrote:
> > Does this catch `std::__1::unique_ptr`, where `__1` is an inline namespace? (Either way, we should add a test)
> > 
> > Maybe it's better to first filter declarations using an `isInStdNamespace` matcher and then check for the name `unique_ptr`.
> Tests for other checks don't contain libc++ specific, so if problems existed they were resolved long time ago.
Using versioning namespaces is not specific to libc++. But, as you suggested, this case appears to work.

I also see that this is just a copy of `modernize/MakeUniqueCheck.cpp`. Can we find a way to share the matcher between these two implementations?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55044/new/

https://reviews.llvm.org/D55044





More information about the cfe-commits mailing list