mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 04:36:06 +00:00

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.
14 lines
297 B
Common Lisp
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
|
|
}
|