[clang] [clang-tools-extra] [CudaSPIRV] Allow using integral non-type template parameters as attribute args (PR #131546)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 16 20:44:58 PDT 2025


================
@@ -753,12 +753,20 @@ void CodeGenModule::handleAMDGPUFlatWorkGroupSizeAttr(
     int32_t *MaxThreadsVal) {
   unsigned Min = 0;
   unsigned Max = 0;
+  auto Eval = [&](Expr *E) {
+    return E->EvaluateKnownConstInt(getContext()).getExtValue();
+  };
   if (FlatWGS) {
-    Min = FlatWGS->getMin()->EvaluateKnownConstInt(getContext()).getExtValue();
-    Max = FlatWGS->getMax()->EvaluateKnownConstInt(getContext()).getExtValue();
+    Min = Eval(
+        FlatWGS
+            ->getMin());
+    Max = Eval(
+        FlatWGS
+            ->getMax());
----------------
arsenm wrote:

Fix formatting 

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


More information about the cfe-commits mailing list