[clang] [HLSL] Use hlsl_device address space for getpointer. (PR #127675)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 18:11:42 PDT 2025


================
@@ -751,13 +751,14 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name,
   using PH = BuiltinTypeMethodBuilder::PlaceHolder;
 
   QualType ElemTy = getHandleElementType();
-  // TODO: Map to an hlsl_device address space.
-  QualType ElemPtrTy = AST.getPointerType(ElemTy);
-  QualType ReturnTy = ElemTy;
+  QualType AddrSpaceElemTy =
+      AST.getAddrSpaceQualType(ElemTy, LangAS::hlsl_device);
+  QualType ElemPtrTy = AST.getPointerType(AddrSpaceElemTy);
+  // QualType ReturnTy = (IsRef ? AST.getLValueReferenceType(ElemTy) : ElemTy);
----------------
hekota wrote:

You probably want to remove this commented code:
```suggestion
```

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


More information about the cfe-commits mailing list