[clang] [HLSL] Allow arrays to be returned by value in HLSL (PR #127896)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 24 08:05:27 PST 2025


================
@@ -2803,6 +2803,10 @@ class ASTContext : public RefCountedBase<ASTContext> {
     return getUnqualifiedArrayType(T, Quals);
   }
 
+  // Determine whether an array is a valid return type
+  // Array is a valid return type for HLSL
+  bool isReturnableArrayType() const { return getLangOpts().HLSL; }
----------------
llvm-beanz wrote:

Looking at how this is used, it might actually just be better if this were a function on LangOpts. Then you could just have something similar to what you wrote, just on the language options:

```
bool allowArrayReturnTypes() const { return HLSL; }
```

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


More information about the cfe-commits mailing list