[Clang][Driver] Fix `--save-temps` for OpenCL AoT compilation (#78333)
commitdc410f94f602390a65c832cf348b9ee6556b1809
authorShilei Tian <i@tianshilei.me>
Tue, 23 Jan 2024 22:08:04 +0000 (23 17:08 -0500)
committerGitHub <noreply@github.com>
Tue, 23 Jan 2024 22:08:04 +0000 (23 17:08 -0500)
tree49924e91a9cdfde79ffcb78e2d6f95c480476538
parent729657d6e15d0455557f35485deb87313ccdde10
[Clang][Driver] Fix `--save-temps` for OpenCL AoT compilation (#78333)

We can directly call `clang -c -x cl -target amdgcn -mcpu=gfx90a test.cl
-o test.o`
to compile an OpenCL kernel file. However, when `--save-temps` is
enabled, it doesn't
work because the preprocessed file (`.i` file) is taken as C source file
when it
is fed to the front end, thus causing compilation error because those
OpenCL keywords
can't be recognized. This patch fixes the issue.
clang/include/clang/Driver/Types.def
clang/lib/Driver/Types.cpp
clang/test/Driver/opencl_aot_save_temps.cl [new file with mode: 0644]