python3kgae marked 6 inline comments as done.
python3kgae added inline comments.

================
Comment at: clang/include/clang/Driver/Types.def:110
 TYPE("api-information",          API_INFO,     INVALID,         "json",   
phases::Precompile)
+TYPE("dx-container",             DX_CONTAINER, INVALID,         "dxc",    
phases::Compile, phases::Backend)
 TYPE("none",                     Nothing,      INVALID,         nullptr,  
phases::Compile, phases::Backend, phases::Assemble, phases::Link)
----------------
beanz wrote:
> The normal dx-container extension is `dxbc` right? not `dxc`?
There's no official extension.
Will go with dxo.


================
Comment at: clang/lib/Driver/Driver.cpp:4218
+    // Only add action when needValidation.
+    if (toolchains::HLSLToolChain::needValidation(Args, *this,
+                                                  C.getDefaultToolChain())) {
----------------
jhuber6 wrote:
> 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.

```
    const auto &TC = static_cast<const toolchains::HLSLToolChain *>(
        getToolChain(Args, C.getDefaultToolChain().getTriple()));
```
will hit " no viable conversion from 'const clang::driver::ToolChain' to 'const 
toolchains::HLSLToolChain'"

```
    const auto &TC = getToolChain(Args, C.getDefaultToolChain().getTriple());
    const auto *HLSLTC = static_cast<const toolchains::HLSLToolChain *>(&TC);
```
works, is it OK?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141705

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to