Files
clang-p2996/compiler-rt/lib/orc/tests/unit/extensible_rtti_test.cpp
Lang Hames 1169586dcd [ORC-RT] Refactor ORC runtime CMake for future test tool(s).
We want to move functionality from the LLVM ORCTargetProcess library into the
ORC runtime, and this will mean implementing remote-executor testing tools
(like llvm-jitlink-executor and lli-child-target) in the ORC runtime.

This patch refactors the ORC runtime build system to introduce an
add_orc_tool function that can be used to add new test tools. The code is
modeled on existing functions for adding unit tests.

A placeholder orc-rt-executor tool and test are added to verify that the
config changes behave as expected.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D133084
2022-09-02 20:59:57 -07:00

55 lines
1.5 KiB
C++

//===-- extensible_rtti_test.cpp ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of the ORC runtime.
//
// Note:
// This unit test was adapted from
// llvm/unittests/Support/ExtensibleRTTITest.cpp
//
//===----------------------------------------------------------------------===//
#include "extensible_rtti.h"
#include "gtest/gtest.h"
using namespace __orc_rt;
namespace {
class MyBase : public RTTIExtends<MyBase, RTTIRoot> {};
class MyDerivedA : public RTTIExtends<MyDerivedA, MyBase> {};
class MyDerivedB : public RTTIExtends<MyDerivedB, MyBase> {};
} // end anonymous namespace
TEST(ExtensibleRTTITest, BaseCheck) {
MyBase MB;
MyDerivedA MDA;
MyDerivedB MDB;
// Check MB properties.
EXPECT_TRUE(isa<RTTIRoot>(MB));
EXPECT_TRUE(isa<MyBase>(MB));
EXPECT_FALSE(isa<MyDerivedA>(MB));
EXPECT_FALSE(isa<MyDerivedB>(MB));
// Check MDA properties.
EXPECT_TRUE(isa<RTTIRoot>(MDA));
EXPECT_TRUE(isa<MyBase>(MDA));
EXPECT_TRUE(isa<MyDerivedA>(MDA));
EXPECT_FALSE(isa<MyDerivedB>(MDA));
// Check MDB properties.
EXPECT_TRUE(isa<RTTIRoot>(MDB));
EXPECT_TRUE(isa<MyBase>(MDB));
EXPECT_FALSE(isa<MyDerivedA>(MDB));
EXPECT_TRUE(isa<MyDerivedB>(MDB));
}