Debian Codegraph @

clang/test/OpenMP/target_vtable_codegen_container.cpp

raw
1 // RUN: %clang_cc1 -verify -fopenmp -Wno-openmp-mapping -x c++ -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-cuda-mode -emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=52 -stdlib=libc++
2 // RUN: %clang_cc1 -verify -fopenmp -Wno-openmp-mapping -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-cuda-mode -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - -debug-info-kind=limited -fopenmp-version=52 -stdlib=libc++ | FileCheck %s
3 // expected-no-diagnostics
4
5 // CHECK-DAG: @_ZTV7Derived
6 // CHECK-DAG: @_ZTV4Base
7 template <typename T>
8 class Container {
9 private:
10 T value;
11 public:
12 Container() : value() {}
13 Container(T val) : value(val) {}
14
15 T getValue() const { return value; }
16
17 void setValue(T val) { value = val; }
18 };
19
20 class Base {
21 public:
22 virtual void foo() {}
23 };
24 class Derived : public Base {};
25
26 class Test {
27 public:
28 Container<Derived> v;
29 };
30
31 int main() {
32 Test test;
33 Derived d;
34 test.v.setValue(d);
35
36 // Make sure we emit VTable for type indirectly (template specialized type)
37 #pragma omp target map(test)
38 {
39 test.v.getValue().foo();
40 }
41 return 0;
42 }