File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
plugins-nextgen/common/PluginInterface Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -511,6 +511,9 @@ void *GenericKernelTy::prepareArgs(
511
511
uint32_t &NumArgs, llvm::SmallVectorImpl<void *> &Args,
512
512
llvm::SmallVectorImpl<void *> &Ptrs,
513
513
KernelLaunchEnvironmentTy *KernelLaunchEnvironment) const {
514
+ if (isCtorOrDtor ())
515
+ return nullptr ;
516
+
514
517
NumArgs += 1 ;
515
518
516
519
Args.resize (NumArgs);
Original file line number Diff line number Diff line change @@ -284,6 +284,12 @@ struct GenericKernelTy {
284
284
// / Get the kernel name.
285
285
const char *getName () const { return Name; }
286
286
287
+ // / Return true if this kernel is a constructor or destructor.
288
+ bool isCtorOrDtor () const {
289
+ // TODO: This is not a great solution and should be revisited.
290
+ return StringRef (Name).endswith (" tor" );
291
+ }
292
+
287
293
// / Get the kernel image.
288
294
DeviceImageTy &getImage () const {
289
295
assert (ImagePtr && " Kernel is not initialized!" );
Original file line number Diff line number Diff line change
1
+ // RUN: %libomptarget-compilexx-run-and-check-generic
2
+ // RUN: %libomptarget-compileoptxx-run-and-check-generic
3
+ //
4
+ #include < cstdio>
5
+ struct S {
6
+ S () : i(7 ) {}
7
+ ~S () { foo (); }
8
+ int foo () { return i; }
9
+
10
+ private:
11
+ int i;
12
+ };
13
+
14
+ S s;
15
+ #pragma omp declare target(s)
16
+
17
+ int main () {
18
+ int r;
19
+ #pragma omp target map(from : r)
20
+ r = s.foo ();
21
+
22
+ // CHECK: 7
23
+ printf (" %i\n " , r);
24
+ }
You can’t perform that action at this time.
0 commit comments