njames93 added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp:41-47
+  const Decl *ParentDecl = ConstructParents.begin()->get<Decl>();
+  if (!ParentDecl)
+    return nullptr;
+  if (const auto *ParentVar = dyn_cast<VarDecl>(ParentDecl))
+    return ParentVar;
+  if (const auto *ParentField = dyn_cast<FieldDecl>(ParentDecl))
+    return ParentField;
----------------



================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.h:40
+  /// in this class.
+  virtual SmartPtrClassMatcher getSmartPointerClassMatcher() const = 0;
+
----------------
LegalizeAdulthood wrote:
> There's only one implementation of this abstract method declared here.
> 
> Why the extra level in the class hierarchy if there's only one implementation?
The idea I think is so that this can be used to make a similar check for 
`unique_ptr`. However I almost don't see the need for this, and I'd argue that 
they should both be implemented in one check. So this will detect 
```lang=c++
std::shared_ptr<int> X = new int[5];
std::unique_ptr<int> Y = new int[5];
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117306

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to