Module: Mesa
Branch: main
Commit: 9540259e1cb729609995376d738034d7b1b2e24e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9540259e1cb729609995376d738034d7b1b2e24e

Author: Caio Oliveira <[email protected]>
Date:   Mon Nov 20 22:51:03 2023 -0800

intel/compiler: Prefer ctor/dtors in some Google Tests

Per Google Test FAQ recommendation, prefer consutrctors and destructors
unless there's a need to use SetUp/TearDown.

We will take advantage of this later to initialize an fs_builder.

Reviewed-by: Ian Romanick <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26301>

---

 src/intel/compiler/test_fs_cmod_propagation.cpp     | 10 +++++-----
 src/intel/compiler/test_fs_copy_propagation.cpp     | 10 +++++-----
 src/intel/compiler/test_fs_saturate_propagation.cpp | 10 +++++-----
 src/intel/compiler/test_fs_scoreboard.cpp           | 10 +++++-----
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/intel/compiler/test_fs_cmod_propagation.cpp 
b/src/intel/compiler/test_fs_cmod_propagation.cpp
index 0c6816ad501..92b09504aa9 100644
--- a/src/intel/compiler/test_fs_cmod_propagation.cpp
+++ b/src/intel/compiler/test_fs_cmod_propagation.cpp
@@ -28,10 +28,10 @@
 using namespace brw;
 
 class cmod_propagation_test : public ::testing::Test {
-   virtual void SetUp();
-   virtual void TearDown();
+protected:
+   cmod_propagation_test();
+   ~cmod_propagation_test() override;
 
-public:
    struct brw_compiler *compiler;
    struct brw_compile_params params;
    struct intel_device_info *devinfo;
@@ -64,7 +64,7 @@ public:
 };
 
 
-void cmod_propagation_test::SetUp()
+cmod_propagation_test::cmod_propagation_test()
 {
    ctx = ralloc_context(NULL);
    compiler = rzalloc(ctx, struct brw_compiler);
@@ -84,7 +84,7 @@ void cmod_propagation_test::SetUp()
    devinfo->verx10 = devinfo->ver * 10;
 }
 
-void cmod_propagation_test::TearDown()
+cmod_propagation_test::~cmod_propagation_test()
 {
    delete v;
    v = NULL;
diff --git a/src/intel/compiler/test_fs_copy_propagation.cpp 
b/src/intel/compiler/test_fs_copy_propagation.cpp
index 961187bd7f8..06cb89a21ef 100644
--- a/src/intel/compiler/test_fs_copy_propagation.cpp
+++ b/src/intel/compiler/test_fs_copy_propagation.cpp
@@ -28,10 +28,10 @@
 using namespace brw;
 
 class copy_propagation_test : public ::testing::Test {
-   virtual void SetUp();
-   virtual void TearDown();
+protected:
+   copy_propagation_test();
+   ~copy_propagation_test() override;
 
-public:
    struct brw_compiler *compiler;
    struct brw_compile_params params;
    struct intel_device_info *devinfo;
@@ -53,7 +53,7 @@ public:
 };
 
 
-void copy_propagation_test::SetUp()
+copy_propagation_test::copy_propagation_test()
 {
    ctx = ralloc_context(NULL);
    compiler = rzalloc(ctx, struct brw_compiler);
@@ -73,7 +73,7 @@ void copy_propagation_test::SetUp()
    devinfo->verx10 = devinfo->ver * 10;
 }
 
-void copy_propagation_test::TearDown()
+copy_propagation_test::~copy_propagation_test()
 {
    delete v;
    v = NULL;
diff --git a/src/intel/compiler/test_fs_saturate_propagation.cpp 
b/src/intel/compiler/test_fs_saturate_propagation.cpp
index c17882a4acf..7cd468398c4 100644
--- a/src/intel/compiler/test_fs_saturate_propagation.cpp
+++ b/src/intel/compiler/test_fs_saturate_propagation.cpp
@@ -28,10 +28,10 @@
 using namespace brw;
 
 class saturate_propagation_test : public ::testing::Test {
-   virtual void SetUp();
-   virtual void TearDown();
+protected:
+   saturate_propagation_test();
+   ~saturate_propagation_test() override;
 
-public:
    struct brw_compiler *compiler;
    struct brw_compile_params params;
    struct intel_device_info *devinfo;
@@ -53,7 +53,7 @@ public:
 };
 
 
-void saturate_propagation_test::SetUp()
+saturate_propagation_test::saturate_propagation_test()
 {
    ctx = ralloc_context(NULL);
    compiler = rzalloc(ctx, struct brw_compiler);
@@ -73,7 +73,7 @@ void saturate_propagation_test::SetUp()
    devinfo->verx10 = devinfo->ver * 10;
 }
 
-void saturate_propagation_test::TearDown()
+saturate_propagation_test::~saturate_propagation_test()
 {
    delete v;
    v = NULL;
diff --git a/src/intel/compiler/test_fs_scoreboard.cpp 
b/src/intel/compiler/test_fs_scoreboard.cpp
index a7fe5f1b014..2882ed524b6 100644
--- a/src/intel/compiler/test_fs_scoreboard.cpp
+++ b/src/intel/compiler/test_fs_scoreboard.cpp
@@ -28,10 +28,10 @@
 using namespace brw;
 
 class scoreboard_test : public ::testing::Test {
-   virtual void SetUp();
-   virtual void TearDown();
+protected:
+   scoreboard_test();
+   ~scoreboard_test() override;
 
-public:
    struct brw_compiler *compiler;
    struct brw_compile_params params;
    struct intel_device_info *devinfo;
@@ -41,7 +41,7 @@ public:
    fs_visitor *v;
 };
 
-void scoreboard_test::SetUp()
+scoreboard_test::scoreboard_test()
 {
    ctx = ralloc_context(NULL);
    compiler = rzalloc(ctx, struct brw_compiler);
@@ -64,7 +64,7 @@ void scoreboard_test::SetUp()
 
 }
 
-void scoreboard_test::TearDown()
+scoreboard_test::~scoreboard_test()
 {
    delete v;
    v = NULL;

Reply via email to