[PATCH] D124751: [HLSL] Support -E option for HLSL.

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 07:03:18 PDT 2022


beanz added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:9887
+          break;
+        case llvm::Triple::EnvironmentType::Compute:
+          ShaderType = HLSLShaderAttr::ShaderType::Compute;
----------------
If the `HLSLShaderAttr::ShaderType` enum is properly ordered you should be able to convert the integer value:

```
HLSLShaderAttr::ShaderType StageInteger = (HLSLShaderAttr::ShaderType)TI.getTriple().getEnvironment() -
                            (uint32_t)llvm::Triple::Pixel;
```

Then this code doesn't need to be updated if a new shader type is added.


================
Comment at: clang/test/SemaHLSL/entry.hlsl:16
+}
\ No newline at end of file

----------------
Please fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124751



More information about the cfe-commits mailing list