================
@@ -278,33 +280,35 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
         auto Header = dxbc::RootParameterHeader{Param.Type, Param.Visibility,
                                                 Param.Offset};
 
-        switch (Param.Type) {
-        case llvm::to_underlying(dxbc::RootParameterType::Constants32Bit):
+        
if(std::holds_alternative<DXContainerYAML::RootConstantsYaml>(Param.Data)){
+          auto ConstantYaml = 
std::get<DXContainerYAML::RootConstantsYaml>(Param.Data);
----------------
damyanp wrote:

```suggestion
        if (auto* ConstantYaml = 
std::get_if<DXContainerYAML::RootConstantsYaml>(&Param.Data)) {
```

(If I remember how variant works correctly)

Saves some repetitive code, and also allows you to pull the data directly out 
of `Param.Data` without making a copy of it.

https://github.com/llvm/llvm-project/pull/138318
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to