aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:108-113
+    if (Template) {
+      if (auto TTD = dyn_cast<TemplateTypeParmDecl>(
+              Template->getTemplateParameters()->getParam(0)))
+        Ty = Record->getASTContext().getPointerType(
+            QualType(TTD->getTypeForDecl(), 0));
+    }
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:180
+    if (Handle->getType().getCanonicalType() != AST.VoidPtrTy) {
+      Call = CXXReinterpretCastExpr::Create(
+          AST, Handle->getType(), VK_PRValue, CK_Dependent, Call, nullptr,
----------------
Can you use a `static_cast` to make this a wee bit safer, or is that not 
possible?


================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:231-232
+        AST.getFunctionType(ReturnTy, {AST.UnsignedIntTy}, ExtInfo);
+    auto TSInfo = AST.getTrivialTypeSourceInfo(MethodTy, SourceLocation());
+    auto MethodDecl = CXXMethodDecl::Create(
+        AST, Record, SourceLocation(),
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:241
+    IdentifierInfo &II = AST.Idents.get("Idx", tok::TokenKind::identifier);
+    auto IdxParam = ParmVarDecl::Create(
+        AST, MethodDecl->getDeclContext(), SourceLocation(), SourceLocation(),
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:243
+        AST, MethodDecl->getDeclContext(), SourceLocation(), SourceLocation(),
+        &II, AST.UnsignedIntTy,
+        AST.getTrivialTypeSourceInfo(AST.UnsignedIntTy, SourceLocation()),
----------------
Should this be using a size type instead?


================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:252
+
+    CXXThisExpr *This = new (AST)
+        CXXThisExpr(SourceLocation(), MethodDecl->getThisType(), true);
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:254
+        CXXThisExpr(SourceLocation(), MethodDecl->getThisType(), true);
+    Expr *HandleAccess = MemberExpr::CreateImplicit(
+        AST, This, true, Handle, Handle->getType(), VK_LValue, OK_Ordinary);
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:257
+
+    Expr *IndexExpr = DeclRefExpr::Create(
+        AST, NestedNameSpecifierLoc(), SourceLocation(), IdxParam, false,
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:262
+
+    Expr *Array =
+        new (AST) ArraySubscriptExpr(HandleAccess, IndexExpr, ElemTy, 
VK_LValue,
----------------



================
Comment at: clang/lib/Sema/HLSLExternalSemaSource.cpp:266
+
+    Stmt *Return = ReturnStmt::Create(AST, SourceLocation(), Array, nullptr);
+
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131268

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to