Skip to content

Commit acd45af

Browse files
committed
cleanup after merge, add one more comment
1 parent 3e85c31 commit acd45af

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ static std::optional<llvm::Value *> initializeLocalResourceArray(
248248
Args);
249249

250250
if (!CreateMethod)
251+
// This can happen if someone creates an array of structs that looks like
252+
// an HLSL resource record array but it does not have the required static
253+
// create method. No binding will be generated for it.
251254
return std::nullopt;
252255

253256
callResourceInitMethod(CGF, CreateMethod, Args, ReturnAddress);

clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ struct BuiltinTypeMethodBuilder {
130130
StorageClass SC;
131131
llvm::SmallVector<Param> Params;
132132
llvm::SmallVector<Stmt *> StmtsList;
133-
llvm::SmallVector<VarDecl *> LocalVars;
134133

135134
// Argument placeholders, inspired by std::placeholder. These are the indices
136135
// of arguments to forward to `callBuiltin` and other method builder methods.
@@ -139,16 +138,7 @@ struct BuiltinTypeMethodBuilder {
139138
// LastStmt - refers to the last statement in the method body; referencing
140139
// LastStmt will remove the statement from the method body since
141140
// it will be linked from the new expression being constructed.
142-
enum class PlaceHolder {
143-
_0,
144-
_1,
145-
_2,
146-
_3,
147-
_4,
148-
LocalVar_0 = 64,
149-
Handle = 128,
150-
LastStmt
151-
};
141+
enum class PlaceHolder { _0, _1, _2, _3, _4, Handle = 128, LastStmt };
152142

153143
Expr *convertPlaceholder(PlaceHolder PH);
154144
Expr *convertPlaceholder(LocalVar &Var);
@@ -365,17 +355,6 @@ Expr *BuiltinTypeMethodBuilder::convertPlaceholder(PlaceHolder PH) {
365355
}
366356

367357
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
368-
if (PH >= PlaceHolder::LocalVar_0) {
369-
unsigned Index = static_cast<unsigned>(PH) -
370-
static_cast<unsigned>(PlaceHolder::LocalVar_0);
371-
assert(Index < LocalVars.size() && "local var index out of range");
372-
VarDecl *VD = LocalVars[Index];
373-
return DeclRefExpr::Create(
374-
AST, NestedNameSpecifierLoc(), SourceLocation(), VD, false,
375-
DeclarationNameInfo(VD->getDeclName(), SourceLocation()), VD->getType(),
376-
VK_LValue);
377-
}
378-
379358
ParmVarDecl *ParamDecl = Method->getParamDecl(static_cast<unsigned>(PH));
380359
return DeclRefExpr::Create(
381360
AST, NestedNameSpecifierLoc(), SourceLocation(), ParamDecl, false,

0 commit comments

Comments
 (0)