[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / CodeGenHIP / printf-aggregate.cpp
blob9dfbfac2754f77e70e397ed2282b69b0e06c46b7
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -x hip -fcuda-is-device \
3 // RUN: -verify -emit-llvm-only %s
5 #define __device__ __attribute__((device))
6 extern "C" __device__ int printf(const char *format, ...);
8 // Check that we don't crash when asked to printf a non-scalar arg.
9 struct Struct {
10 int x;
11 int y;
14 __device__ void PrintfNonScalar(const char *fmt) {
15 printf(fmt, 1);
16 // Ignore the warning about the %d not matching the struct argument
17 // expected-warning@+2 {{}}
18 // expected-error@+1 {{cannot compile this non-scalar arg to printf}}
19 printf("%d", Struct());