File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult& Result) {
117
117
const auto * MatchedLeafStatement =
118
118
Result.Nodes .getNodeAs <Stmt>(" leaf_statement" );
119
119
120
+ if (!MatchedDecl->hasLocalStorage ()) return ;
121
+
120
122
if (MatchedUseCall) {
121
123
return ;
122
124
}
Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ void f_using(SharedPtr ptr)
41
41
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: could be std::move() [performance-lost-std-move]
42
42
}
43
43
44
+ void f_thread_local ()
45
+ {
46
+ thread_local std::shared_ptr<int > ptr;
47
+ if (*ptr)
48
+ f (ptr);
49
+ }
50
+
51
+ void f_static ()
52
+ {
53
+ static std::shared_ptr<int > ptr;
54
+ if (*ptr)
55
+ f (ptr);
56
+ }
57
+
58
+ void f_extern ()
59
+ {
60
+ extern std::shared_ptr<int > ptr;
61
+ if (*ptr)
62
+ f (ptr);
63
+ }
64
+
44
65
void f_local ()
45
66
{
46
67
std::shared_ptr<int > ptr;
@@ -112,3 +133,10 @@ int f_multiple_usages()
112
133
std::shared_ptr<int > ptr;
113
134
return f (ptr) + f (ptr);
114
135
}
136
+
137
+ #define FUN (x ) f((x))
138
+ int f_macro ()
139
+ {
140
+ std::shared_ptr<int > ptr;
141
+ return FUN (ptr);
142
+ }
You can’t perform that action at this time.
0 commit comments