This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 66#define FLUTTER_FML_PLATFORM_DARWIN_SCOPED_NSOBJECT_H_
77
88#include < type_traits>
9+ #include < utility>
910
1011// Include NSObject.h directly because Foundation.h pulls in many dependencies.
1112// (Approx 100k lines of code versus 1.5k for NSObject.h). scoped_nsobject gets
Original file line number Diff line number Diff line change 1010
1111namespace {
1212
13+ // This is to suppress the bugprone-use-after-move warning.
14+ // This strategy is recommanded here:
15+ // https://clang.llvm.org/extra/clang-tidy/checks/bugprone/use-after-move.html#silencing-erroneous-warnings
16+ template <class T >
17+ void IS_INITIALIZED (T&) {}
18+
1319TEST (ScopedNSObjectTest, ScopedNSObject) {
1420 fml::scoped_nsobject<NSObject > p1 ([[NSObject alloc ] init ]);
1521 ASSERT_TRUE (p1.get ());
5157 }
5258 ASSERT_EQ (2u , [p1 retainCount ]);
5359
54- fml::scoped_nsobject<NSObject > p7 ([NSObject new ]);
60+ fml::scoped_nsobject<NSObject > p7 ([[ NSObject alloc ] init ]);
5561 fml::scoped_nsobject<NSObject > p8 (std::move (p7));
5662 ASSERT_TRUE (p8);
5763 ASSERT_EQ (1u , [p8 retainCount ]);
64+ IS_INITIALIZED (p7);
5865 ASSERT_FALSE (p7.get ());
5966}
6067
You can’t perform that action at this time.
0 commit comments