Browse Source

any/meta_any: no leaks here clang, but thanks for asking

Michele Caini 1 year ago
parent
commit
0d944f6547
2 changed files with 4 additions and 0 deletions
  1. 2 0
      test/entt/core/any.cpp
  2. 2 0
      test/entt/meta/meta_any.cpp

+ 2 - 0
test/entt/core/any.cpp

@@ -82,6 +82,7 @@ TEST(Any, NoSBO) {
 
 
 TEST(Any, SBOInPlaceConstruction) {
 TEST(Any, SBOInPlaceConstruction) {
     std::unique_ptr<int> elem = std::make_unique<int>(2);
     std::unique_ptr<int> elem = std::make_unique<int>(2);
+    // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
     entt::any any{std::in_place, elem.release()};
     entt::any any{std::in_place, elem.release()};
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);
@@ -400,6 +401,7 @@ TEST(Any, SBOAsConstRefTransferValue) {
 
 
 TEST(Any, NoSBOInPlaceConstruction) {
 TEST(Any, NoSBOInPlaceConstruction) {
     std::unique_ptr<fat> elem = std::make_unique<fat>(.1, .2, .3, .4);
     std::unique_ptr<fat> elem = std::make_unique<fat>(.1, .2, .3, .4);
+    // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
     entt::any any{std::in_place, elem.release()};
     entt::any any{std::in_place, elem.release()};
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);

+ 2 - 0
test/entt/meta/meta_any.cpp

@@ -165,6 +165,7 @@ TEST_F(MetaAny, NoSBO) {
 
 
 TEST_F(MetaAny, SBOInPlaceConstruction) {
 TEST_F(MetaAny, SBOInPlaceConstruction) {
     std::unique_ptr<int> elem = std::make_unique<int>(2);
     std::unique_ptr<int> elem = std::make_unique<int>(2);
+    // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
     entt::meta_any any{std::in_place, elem.release()};
     entt::meta_any any{std::in_place, elem.release()};
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);
@@ -496,6 +497,7 @@ TEST_F(MetaAny, SBOAsConstRefTransferValue) {
 TEST_F(MetaAny, NoSBOInPlaceConstruction) {
 TEST_F(MetaAny, NoSBOInPlaceConstruction) {
     const fat instance{.1, .2, .3, .4};
     const fat instance{.1, .2, .3, .4};
     std::unique_ptr<fat> elem = std::make_unique<fat>(instance);
     std::unique_ptr<fat> elem = std::make_unique<fat>(instance);
+    // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
     entt::meta_any any{std::in_place, elem.release()};
     entt::meta_any any{std::in_place, elem.release()};
 
 
     ASSERT_TRUE(any);
     ASSERT_TRUE(any);