[llvm] Fix build failure in DXILResource.h on newer versions of MSVC (PR #139309)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 11:53:54 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Daniel Paoliello (dpaoliello)

<details>
<summary>Changes</summary>

The change #<!-- -->137258 introduced a build break on newer versions of MSVC:

```
llvm\include\llvm\Analysis\DXILResource.h(674) : warning C4715: 'llvm::DXILResourceBindingInfo::getBindingSpaces': not all control paths return a value
```

Fix is to add a `default` case that will ICE.

---
Full diff: https://github.com/llvm/llvm-project/pull/139309.diff


1 Files Affected:

- (modified) llvm/include/llvm/Analysis/DXILResource.h (+2) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h
index cfeed5c4ef76f..090b6e77eac00 100644
--- a/llvm/include/llvm/Analysis/DXILResource.h
+++ b/llvm/include/llvm/Analysis/DXILResource.h
@@ -670,6 +670,8 @@ class DXILResourceBindingInfo {
       return CBufferSpaces;
     case dxil::ResourceClass::Sampler:
       return SamplerSpaces;
+    default:
+      llvm_unreachable("Invalid resource class");
     }
   }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/139309


More information about the llvm-commits mailing list