CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
115 lines
4.6 KiB
C++
115 lines
4.6 KiB
C++
/// For a class that has a vtable and typeinfo symbol for RTTI, if a user marks
|
|
/// either:
|
|
///
|
|
/// (a) The entire class as dllexport (dllimport)
|
|
/// (b) Any non-inline method of the class as dllexport (dllimport)
|
|
///
|
|
/// then Clang must export the vtable and typeinfo symbol from the TU where they
|
|
/// are defined (the TU containing the definition of the Itanium C++ ABI "key
|
|
/// function") and must import them in other modules where they are referenced.
|
|
|
|
// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-unknown-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition \
|
|
// RUN: | FileCheck %s -check-prefix=WI
|
|
// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition \
|
|
// RUN: | FileCheck %s --check-prefixes=PS
|
|
// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-ps4 -emit-llvm -o - %s -fhalf-no-semantic-interposition \
|
|
// RUN: | FileCheck %s --check-prefixes=PS
|
|
// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-sie-ps5 -emit-llvm -o - %s -fhalf-no-semantic-interposition \
|
|
// RUN: | FileCheck %s --check-prefixes=PS
|
|
|
|
#include <typeinfo>
|
|
|
|
/// Case (a) -- Import Aspect
|
|
/// The entire class is imported. The typeinfo symbol must also be imported, but
|
|
/// the vtable will not be referenced, and so does not need to be imported.
|
|
|
|
// PS-DAG: @_ZTI10FullImport = {{.*}}dllimport
|
|
// WI-DAG: @_ZTI10FullImport = external dllimport constant ptr
|
|
struct __declspec(dllimport) FullImport {
|
|
virtual void inlineFunc() const {}
|
|
virtual void key();
|
|
virtual void func();
|
|
};
|
|
|
|
/// 'FullImport::key()' is the key function, so the vtable and typeinfo symbol
|
|
/// of 'FullImport' will be defined in the TU that contains the definition of
|
|
/// 'key()' (and they must be exported from there).
|
|
void FullImportTest() { typeid(FullImport).name(); }
|
|
|
|
/// Case (a) -- Export Aspect
|
|
/// The entire class is exported. The vtable and typeinfo symbols must also be
|
|
/// exported.
|
|
|
|
// PS-DAG: @_ZTV10FullExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTV10FullExport = {{.*}}dllexport
|
|
// PS-DAG: @_ZTI10FullExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTI10FullExport = dso_local dllexport constant {
|
|
struct __declspec(dllexport) FullExport {
|
|
virtual void inlineFunc() const {}
|
|
virtual void key();
|
|
virtual void func();
|
|
};
|
|
|
|
/// This is the key function of the class 'FullExport', so the vtable and
|
|
/// typeinfo symbols of 'FullExport' will be defined in this TU, and so they
|
|
/// must be exported from this TU.
|
|
void FullExport::key() { typeid(FullExport).name(); }
|
|
|
|
/// Case (b) -- Import Aspect
|
|
/// The class as a whole is not imported, but a non-inline method of the class
|
|
/// is, so the vtable and typeinfo symbol must be imported.
|
|
|
|
// PS-DAG: @_ZTV10PartImport = {{.*}}dllimport
|
|
// WI-DAG: @_ZTV10PartImport = external dso_local constant {
|
|
// PS-DAG: @_ZTI10PartImport = {{.*}}dllimport
|
|
// WI-DAG: @_ZTI10PartImport = external dso_local constant ptr
|
|
struct PartImport {
|
|
virtual void inlineFunc() const {}
|
|
virtual void key();
|
|
__declspec(dllimport) virtual void func();
|
|
};
|
|
|
|
/// 'PartImport::key()' is the key function, so the vtable and typeinfo symbol
|
|
/// of 'PartImport' will be defined in the TU that contains the definition of
|
|
/// 'key()' (and they must be exported from there). Here, we will reference the
|
|
/// vtable and typeinfo symbol, so we must also import them.
|
|
void PartImportTest() {
|
|
PartImport f;
|
|
typeid(PartImport).name();
|
|
}
|
|
|
|
/// Case (b) -- Export Aspect
|
|
/// The class as a whole is not exported, but a non-inline method of the class
|
|
/// is, so the vtable and typeinfo symbol must be exported.
|
|
|
|
// PS-DAG: @_ZTV10PartExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTV10PartExport = dso_local constant {
|
|
// PS-DAG: @_ZTI10PartExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTI10PartExport = dso_local constant {
|
|
struct PartExport {
|
|
virtual void inlineFunc() const {}
|
|
virtual void key();
|
|
__declspec(dllexport) virtual void func();
|
|
};
|
|
|
|
/// This is the key function of the class 'PartExport', so the vtable and
|
|
/// typeinfo symbol of 'PartExport' will be defined in this TU, and so they must
|
|
/// be exported from this TU.
|
|
void PartExport::key() { typeid(PartExport).name(); }
|
|
|
|
/// Case (b) -- Export Aspect
|
|
/// The class as a whole is not exported, but the constructor of the class
|
|
/// is, so the vtable and typeinfo symbol must be exported.
|
|
|
|
// PS-DAG: @_ZTV10ConsExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTV10ConsExport = dso_local constant {
|
|
// PS-DAG: @_ZTI10ConsExport = {{.*}}dllexport
|
|
// WI-DAG: @_ZTI10ConsExport = dso_local constant {
|
|
struct ConsExport {
|
|
__declspec(dllexport) ConsExport();
|
|
virtual void key();
|
|
};
|
|
|
|
ConsExport::ConsExport() {}
|
|
void ConsExport::key() { typeid(ConsExport).name(); }
|