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
71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
#define PLACE_IN_TCB(NAME) [[clang::enforce_tcb(NAME)]]
|
|
#define PLACE_IN_TCB_LEAF(NAME) [[clang::enforce_tcb_leaf(NAME)]]
|
|
|
|
PLACE_IN_TCB("foo") void in_tcb_foo();
|
|
void not_in_tcb();
|
|
|
|
// Test behavior on classes and methods.
|
|
class C {
|
|
void bar();
|
|
|
|
PLACE_IN_TCB("foo")
|
|
void foo() {
|
|
// TODO: Figure out if we want to support methods at all.
|
|
// Does it even make sense to isolate individual methods into a TCB?
|
|
// Maybe a per-class attribute would make more sense?
|
|
bar(); // expected-warning{{calling 'bar' is a violation of trusted computing base 'foo'}}
|
|
}
|
|
};
|
|
|
|
// Test behavior on templates.
|
|
template <typename Ty>
|
|
PLACE_IN_TCB("foo")
|
|
void foo_never_instantiated() {
|
|
not_in_tcb(); // expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
|
|
in_tcb_foo(); // no-warning
|
|
}
|
|
|
|
template <typename Ty>
|
|
PLACE_IN_TCB("foo")
|
|
void foo_specialized();
|
|
|
|
template<>
|
|
void foo_specialized<int>() {
|
|
not_in_tcb(); // expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
|
|
in_tcb_foo(); // no-warning
|
|
}
|
|
|
|
PLACE_IN_TCB("foo")
|
|
void call_template_good() {
|
|
foo_specialized<int>(); // no-warning
|
|
}
|
|
PLACE_IN_TCB("bar")
|
|
void call_template_bad() {
|
|
foo_specialized<int>(); // expected-warning{{calling 'foo_specialized<int>' is a violation of trusted computing base 'bar'}}
|
|
}
|
|
|
|
template<typename Ty>
|
|
void foo_specialization_in_tcb();
|
|
|
|
template<>
|
|
PLACE_IN_TCB("foo")
|
|
void foo_specialization_in_tcb<int>() {
|
|
not_in_tcb(); //expected-warning{{calling 'not_in_tcb' is a violation of trusted computing base 'foo'}}
|
|
in_tcb_foo(); // no-warning
|
|
}
|
|
|
|
template<>
|
|
void foo_specialization_in_tcb<double>() {
|
|
not_in_tcb(); // no-warning
|
|
in_tcb_foo(); // no-warning
|
|
}
|
|
|
|
PLACE_IN_TCB("foo")
|
|
void call_specialization_in_tcb() {
|
|
foo_specialization_in_tcb<int>(); // no-warning
|
|
foo_specialization_in_tcb<long>(); // expected-warning{{calling 'foo_specialization_in_tcb<long>' is a violation of trusted computing base 'foo'}}
|
|
foo_specialization_in_tcb<double>(); // expected-warning{{'foo_specialization_in_tcb<double>' is a violation of trusted computing base 'foo'}}
|
|
}
|