[PATCH] D141705: [HLSL] [Dirver] add dxv as a Driver Action Job
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 27 13:09:33 PST 2023
jhuber6 added inline comments.
================
Comment at: clang/lib/Driver/Driver.cpp:4218
+ // Only add action when needValidation.
+ if (toolchains::HLSLToolChain::needValidation(Args, *this,
+ C.getDefaultToolChain())) {
----------------
python3kgae wrote:
> jhuber6 wrote:
> > This should work, shouldn't it?
> > ```
> > const auto &TC = static_cast<const toolchains::HLSLToolChain &>(getToolChain());
> > ```
> I'm not sure getToolChain will return a HLSLToolChain.
> Is it OK to use dynamic_cast?
Well, how is the compilation normally invoked? The `Driver::getToolChain()` function clearly returns an `HLSLToolChain` if the triple is `ShaderModel`. I'm assuming that's the only way to create this, and its set in the compilation. So it should be the ToolChain of the main compilation. This is in contract to an offloading compilation that can have multiple toolchains floating around I'm guessing.
And no, `dynamic_cast` doesn't work in LLVM. LLVM RTTI requires implementing a `classof` function, e.g. https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html, which the ToolChains don't use.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141705/new/
https://reviews.llvm.org/D141705
More information about the cfe-commits
mailing list