Fix Arm64InstEmulation tests for windows
authorPavel Labath <labath@google.com>
Tue, 11 Oct 2016 11:05:34 +0000 (11:05 +0000)
committerPavel Labath <labath@google.com>
Tue, 11 Oct 2016 11:05:34 +0000 (11:05 +0000)
MSVC does not like the declaration of a terminate() function (I guess it looks
too much like std::terminate()). While I'm there, move the setup/teardown code
into the functions gtest provides for that purpose.

llvm-svn: 283870

lldb/unittests/UnwindAssembly/InstEmulation/TestArm64InstEmulation.cpp

index c51aec2..e0e6e52 100644 (file)
@@ -31,18 +31,16 @@ using namespace lldb_private;
 
 class TestArm64InstEmulation : public testing::Test {
 public:
-  //  static void SetUpTestCase() { }
-
-  //  static void TearDownTestCase() { }
+  static void SetUpTestCase();
+  static void TearDownTestCase();
 
   //  virtual void SetUp() override { }
-
   //  virtual void TearDown() override { }
 
 protected:
 };
 
-static void init() {
+void TestArm64InstEmulation::SetUpTestCase() {
   llvm::InitializeAllTargets();
   llvm::InitializeAllAsmPrinters();
   llvm::InitializeAllTargetMCs();
@@ -51,15 +49,12 @@ static void init() {
   EmulateInstructionARM64::Initialize();
 }
 
-static void terminate() {
+void TestArm64InstEmulation::TearDownTestCase() {
   DisassemblerLLVMC::Terminate();
   EmulateInstructionARM64::Terminate();
 }
 
 TEST_F(TestArm64InstEmulation, TestSimpleDarwinFunction) {
-
-  init();
-
   ArchSpec arch("arm64-apple-ios10", nullptr);
   UnwindAssemblyInstEmulation *engine =
       static_cast<UnwindAssemblyInstEmulation *>(
@@ -153,13 +148,9 @@ TEST_F(TestArm64InstEmulation, TestSimpleDarwinFunction) {
   EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == arm64_dwarf::sp);
   EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true);
   EXPECT_EQ(0, row_sp->GetCFAValue().GetOffset());
-
-  terminate();
 }
 
 TEST_F(TestArm64InstEmulation, TestMediumDarwinFunction) {
-  init();
-
   ArchSpec arch("arm64-apple-ios10", nullptr);
   UnwindAssemblyInstEmulation *engine =
       static_cast<UnwindAssemblyInstEmulation *>(
@@ -319,6 +310,4 @@ TEST_F(TestArm64InstEmulation, TestMediumDarwinFunction) {
 
   EXPECT_TRUE(row_sp->GetRegisterInfo(arm64_dwarf::x22, regloc));
   EXPECT_TRUE(regloc.IsSame());
-
-  terminate();
 }