diff options
author | Juan Manuel Martinez CaamaƱo <jmartinezcaamao@gmail.com> | 2025-07-29 08:49:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-29 08:49:36 +0200 |
commit | 8b020d5434078145e2fd2b4f1a48bb1c78ace491 (patch) | |
tree | 6c9d63e3685f26ec717c5edaac205c65e83aa252 /llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp | |
parent | 267eb81d5b92294275881f149a9e6bc5b87c0546 (diff) | |
download | llvm-8b020d5434078145e2fd2b4f1a48bb1c78ace491.zip llvm-8b020d5434078145e2fd2b4f1a48bb1c78ace491.tar.gz llvm-8b020d5434078145e2fd2b4f1a48bb1c78ace491.tar.bz2 |
[Preprocessor] Do not expand macros if the input is already preprocessed (#137665)
Preprocessing the preprocessor output again interacts poorly with some
flag combinations when we perform a separate preprocessing stage. In our
case, `-no-integrated-cpp -dD` triggered this issue; but I guess that
other flags could also trigger problems (`-save-temps` instead of
`-no-integrated-cpp`).
Full context (which is quite weird I'll admit):
* To cache OpenCL kernel compilation results, we use the
`-no-integrated-cpp` for the driver to generate a separate preprocessing
command (`clang -E`) before the rest of the compilation.
* Some OpenCL C language features are implemented as macro definitions
(in `opencl-c-base.h`). The semantic analysis queries the preprocessor
to check if these are defined or not, for example, when we checks if a
builtin is available when using `-fdeclare-opencl-builtins`.
* To preserve these `#define` directives, on the preprocessor's output,
we use `-dD`. However, other `#define` directives are also maintained
besides OpenCL ones; which triggers the issue shown in this PR.
A better fix for our particular case could have been to move the
language features implemented as macros into some sort of a flag to be
used together with `-fdeclare-opencl-builtins`.
But I also thought that not preprocessing preprocessor outputs seemed
like something desirable. I hope to work on this on a follow up.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp')
0 files changed, 0 insertions, 0 deletions