[PATCH] D135721: [HLSL] Added HLSL this as a reference

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 4 11:52:34 PDT 2022


beanz added inline comments.


================
Comment at: clang/test/AST/HLSL/RWBuffer-AST.hlsl:49-50
 // CHECK-NEXT: ArraySubscriptExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type' lvalue
-// CHECK-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type *' lvalue ->h 0x{{[0-9A-Fa-f]+}}
-// CHECK-NEXT: CXXThisExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'const RWBuffer<element_type> *' implicit this
+// CHECK-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type *' lvalue .h 0x{{[0-9A-Fa-f]+}}
+// CHECK-NEXT: CXXThisExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'const RWBuffer<element_type>' lvalue implicit this
 // CHECK-NEXT: DeclRefExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'unsigned int' ParmVar 0x{{[0-9A-Fa-f]+}} 'Idx' 'unsigned int'
----------------
aaron.ballman wrote:
> `// CHECK-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> 'element_type *' lvalue .h 0x{{[0-9A-Fa-f]+}}`
> 
> I'm confused by this -- it says the type of the expression is `element_type *` but that it uses `.` as an operator instead of `->`. One of these seems like it is wrong, but perhaps I'm missing something.
Isn't that the type of the member not the type of the `this`? This example seems to result in a pointer `MemberExpr` with a `.` access: https://godbolt.org/z/j9f5nP4s6

This is a little awkward because we have a pointer member inside this struct even though pointers are illegal in HLSL source :(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135721/new/

https://reviews.llvm.org/D135721



More information about the cfe-commits mailing list