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

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 15:58:21 PDT 2022


python3kgae added inline comments.


================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:179
+        AST, SourceLocation(),
+        Constructor->getThisType().getTypePtr()->getPointeeType(), true);
+    This->setValueKind(ExprValueKind::VK_LValue);
----------------
Should this be a reference type?


================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:266
+        AST, SourceLocation(),
+        MethodDecl->getThisType().getTypePtr()->getPointeeType(), true);
+    This->setValueKind(ExprValueKind::VK_LValue);
----------------
Same here, a reference type?


================
Comment at: clang/lib/Sema/SemaExprMember.cpp:1906
     baseExpr = BuildCXXThisExpr(loc, ThisTy, /*IsImplicit=*/true);
+    if (getLangOpts().HLSL && ThisTy.getTypePtr()->isPointerType()) {
+      ThisTy = ThisTy.getTypePtr()->getPointeeType();
----------------
Is it possible that ThisTy is not a pointer type?


================
Comment at: clang/test/AST/HLSL/RWBuffer-AST.hlsl:50
+// 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'
----------------
reference type?


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