llvm-project/clang/test/Driver/default-includes.cl
Aaron Ballman a9d68a5524 Generalize calls to ImplicitlyDefineFunction
In C++ and C2x, we would avoid calling ImplicitlyDefineFunction at all,
but in OpenCL mode we would still call the function and have it produce
an error diagnostic. Instead, we now have a helper function to
determine when implicit function definitions are allowed and we use
that to determine whether to call ImplicitlyDefineFunction so that the
behavior is more consistent across language modes.

This changes the diagnostic behavior from telling the users that an
implicit function declaration is not allowed in OpenCL to reporting use
of an unknown identifier and going through typo correction, as done in
C++ and C2x.
2022-04-30 10:03:51 -04:00

14 lines
297 B
Common Lisp

// RUN: %clang %s -Xclang -verify -fsyntax-only
// RUN: %clang %s -cl-no-stdinc -Xclang -verify -DNOINC -fsyntax-only
#ifndef NOINC
//expected-no-diagnostics
#endif
void test() {
int i = get_global_id(0);
#ifdef NOINC
//expected-error@-2{{use of undeclared identifier 'get_global_id'}}
#endif
}