llvm-project
6840e604 - [Clang][ExprConstant] Normalize aux target builtin IDs before dispatch (#201805)

Commit
10 days ago
[Clang][ExprConstant] Normalize aux target builtin IDs before dispatch (#201805) When compiling for a device target that has an auxiliary host target (for example OpenMP or CUDA offload), builtins of the auxiliary target are registered with IDs shifted past the primary target's builtins. The constant evaluator passed the raw ID straight into the target-specific evaluation switches in the Pointer/Int/Vector/Float expression evaluators, so a shifted auxiliary ID could fall through to an unrelated builtin's case (or miss its case entirely) and fail to fold. Add a getConstantEvaluatedBuiltinID() helper that translates auxiliary builtin IDs back to their canonical target IDs via BuiltinInfo::getAuxBuiltinID(), and use it before dispatching in each of those evaluators.
Parents
Loading