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) {
117117 const auto * MatchedLeafStatement =
118118 Result.Nodes .getNodeAs <Stmt>(" leaf_statement" );
119119
120+ if (!MatchedDecl->hasLocalStorage ()) return ;
121+
120122 if (MatchedUseCall) {
121123 return ;
122124 }
Original file line number Diff line number Diff line change @@ -41,6 +41,27 @@ void f_using(SharedPtr ptr)
4141 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: could be std::move() [performance-lost-std-move]
4242}
4343
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+
4465void f_local ()
4566{
4667 std::shared_ptr<int > ptr;
@@ -112,3 +133,10 @@ int f_multiple_usages()
112133 std::shared_ptr<int > ptr;
113134 return f (ptr) + f (ptr);
114135}
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