File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,11 @@ void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) {
74
74
// Matcher for standard smart pointers.
75
75
const auto SmartPointerType = qualType (hasUnqualifiedDesugaredType (
76
76
recordType (hasDeclaration (classTemplateSpecializationDecl (
77
- hasAnyName (" ::std::shared_ptr" , " ::std::unique_ptr" ,
78
- " ::std::weak_ptr" , " ::std::auto_ptr" ),
79
- templateArgumentCountIs (1 ))))));
77
+ anyOf (allOf (hasAnyName (" ::std::shared_ptr" , " ::std::weak_ptr" ,
78
+ " ::std::auto_ptr" ),
79
+ templateArgumentCountIs (1 )),
80
+ allOf (hasName (" ::std::unique_ptr" ),
81
+ templateArgumentCountIs (2 ))))))));
80
82
81
83
// We will warn only if the class has a pointer or a C array field which
82
84
// probably causes a problem during self-assignment (e.g. first resetting
Original file line number Diff line number Diff line change @@ -233,6 +233,10 @@ Changes in existing checks
233
233
`bsl::optional ` and `bdlb::NullableValue ` from
234
234
<https://github.com/bloomberg/bde>_.
235
235
236
+ - Improved :doc: `bugprone-unhandled-self-assignment
237
+ <clang-tidy/checks/bugprone/unhandled-self-assignment>` check by fixing smart
238
+ pointer check against std::unique_ptr type.
239
+
236
240
- Improved :doc: `bugprone-unsafe-functions
237
241
<clang-tidy/checks/bugprone/unsafe-functions>` check to allow specifying
238
242
additional functions to match.
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ template <class T>
10
10
T &&move(T &x) {
11
11
}
12
12
13
- template <class T >
13
+ template <typename T> class default_delete {};
14
+
15
+ template <class T , typename Deleter = std::default_delete<T>>
14
16
class unique_ptr {
15
17
};
16
18
You can’t perform that action at this time.
0 commit comments