[PATCH] D133668: [HLSL] Disable integer promotion to avoid int16_t being promoted to int for HLSL.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 19 05:09:46 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:841
+    if (Ty->isPromotableIntegerType() &&
+        // Avoid promote integer type to int.
+        !getLangOpts().HLSL) {
----------------
rjmccall wrote:
> 
Hmm, the downside to the change being applied here is that `isPromotableIntegerType()` is a lie for HLSL and other callers are going to be surprised. I think a better way to achieve this same goal is to move `isPromotableIntegerType()` from `Type` to `ASTContext` so that it has access to the language options, and then hoist the language mode check so that `isPromotableIntegerType()` returns `false` for integer types in HLSL.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133668/new/

https://reviews.llvm.org/D133668



More information about the cfe-commits mailing list