[llvm-branch-commits] [clang] [HLSL] DO NOT MERGE - Resource constructors prototype (PR #132453)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Mar 24 14:09:01 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-hlsl
Author: Helena Kotas (hekota)
<details>
<summary>Changes</summary>
---
Patch is 50.31 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132453.diff
14 Files Affected:
- (modified) clang/include/clang/Basic/Builtins.td (+12)
- (modified) clang/include/clang/Sema/SemaHLSL.h (+4)
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+18)
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+1-1)
- (modified) clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp (+113-67)
- (modified) clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h (+1)
- (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (+2-1)
- (modified) clang/lib/Sema/SemaDecl.cpp (+2-4)
- (modified) clang/lib/Sema/SemaHLSL.cpp (+87)
- (modified) clang/test/CodeGenHLSL/builtins/ByteAddressBuffers-constructors.hlsl (+75-22)
- (modified) clang/test/CodeGenHLSL/builtins/RWBuffer-constructor-opt.hlsl (+1-1)
- (modified) clang/test/CodeGenHLSL/builtins/RWBuffer-constructor.hlsl (+71-7)
- (modified) clang/test/CodeGenHLSL/builtins/StructuredBuffers-constructors.hlsl (+68-37)
- (modified) clang/test/CodeGenHLSL/resource-bindings.hlsl (+31-19)
``````````diff
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 2fbdfaea57ccd..8e3828e4a4771 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4783,6 +4783,18 @@ def HLSLResourceGetPointer : LangBuiltin<"HLSL_LANG"> {
let Prototype = "void(...)";
}
+def HLSLResourceCreatePoisonHandle : LangBuiltin<"HLSL_LANG"> {
+ let Spellings = ["__builtin_hlsl_resource_createpoisonhandle"];
+ let Attributes = [NoThrow];
+ let Prototype = "void(...)";
+}
+
+def HLSLResourceCreateHandleFromBinding : LangBuiltin<"HLSL_LANG"> {
+ let Spellings = ["__builtin_hlsl_resource_createhandlefrombinding"];
+ let Attributes = [NoThrow];
+ let Prototype = "void(...)";
+}
+
def HLSLAll : LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_all"];
let Attributes = [NoThrow, Const];
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index f333fe30e8da0..4ad00b210cccf 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -105,6 +105,7 @@ class SemaHLSL : public SemaBase {
HLSLParamModifierAttr::Spelling Spelling);
void ActOnTopLevelFunction(FunctionDecl *FD);
void ActOnVariableDeclarator(VarDecl *VD);
+ bool ActOnUninitializedVarDecl(VarDecl *D);
void ActOnEndOfTranslationUnit(TranslationUnitDecl *TU);
void CheckEntryPoint(FunctionDecl *FD);
void CheckSemanticAnnotation(FunctionDecl *EntryPoint, const Decl *Param,
@@ -179,6 +180,9 @@ class SemaHLSL : public SemaBase {
void processExplicitBindingsOnDecl(VarDecl *D);
void diagnoseAvailabilityViolations(TranslationUnitDecl *TU);
+ bool initResourceVarFromBinding(VarDecl *VD, unsigned SpaceNo,
+ unsigned RegisterNo, int32_t Range,
+ unsigned Index);
};
} // namespace clang
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index a5ed2595bad4d..5e364b5913a13 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -19579,6 +19579,24 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
RetTy, CGM.getHLSLRuntime().getCreateResourceGetPointerIntrinsic(),
ArrayRef<Value *>{HandleOp, IndexOp});
}
+ case Builtin::BI__builtin_hlsl_resource_createpoisonhandle: {
+ llvm::Type *HandleTy = CGM.getTypes().ConvertType(E->getType());
+ return llvm::PoisonValue::get(HandleTy);
+ }
+ case Builtin::BI__builtin_hlsl_resource_createhandlefrombinding: {
+ llvm::Type *HandleTy = CGM.getTypes().ConvertType(E->getType());
+ Value *SpaceNoOp = EmitScalarExpr(E->getArg(1));
+ Value *RegisterNoOp = EmitScalarExpr(E->getArg(2));
+ Value *RangeOp = EmitScalarExpr(E->getArg(3));
+ Value *IndexOp = EmitScalarExpr(E->getArg(4));
+ // FIXME: NonUniformResourceIndex bit is not yet implemented
+ Value *NonUniform =
+ llvm::ConstantInt::get(llvm::Type::getInt1Ty(getLLVMContext()), false);
+ return Builder.CreateIntrinsic(
+ HandleTy, CGM.getHLSLRuntime().getCreateHandleFromBindingIntrinsic(),
+ ArrayRef<Value *>{SpaceNoOp, RegisterNoOp, RangeOp, IndexOp,
+ NonUniform});
+ }
case Builtin::BI__builtin_hlsl_all: {
Value *Op0 = EmitScalarExpr(E->getArg(0));
return Builder.CreateIntrinsic(
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index dc34653e8f497..b4e693dbe85f2 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -659,7 +659,7 @@ void CGHLSLRuntime::handleGlobalVarDefinition(const VarDecl *VD,
// not implemented yet.
return;
- createResourceInitFn(CGM, GV, RBA->getSlotNumber(), RBA->getSpaceNumber());
+ // createResourceInitFn(CGM, GV, RBA->getSlotNumber(), RBA->getSpaceNumber());
}
llvm::Instruction *CGHLSLRuntime::getConvergenceToken(BasicBlock &BB) {
diff --git a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
index db0ed3434d837..602688d575252 100644
--- a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
+++ b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
@@ -71,39 +71,43 @@ struct TemplateParameterListBuilder {
// BuiltinTypeMethodBuilder(RecordBuilder, "MethodName", ReturnType)
// .addParam("param_name", Type, InOutModifier)
// .callBuiltin("builtin_name", BuiltinParams...)
-// .finalizeMethod();
+// .finalize();
//
// The builder needs to have all of the method parameters before it can create
// a CXXMethodDecl. It collects them in addParam calls and when a first
// method that builds the body is called or when access to 'this` is needed it
// creates the CXXMethodDecl and ParmVarDecls instances. These can then be
// referenced from the body building methods. Destructor or an explicit call to
-// finalizeMethod() will complete the method definition.
+// finalize() will complete the method definition.
//
// The callBuiltin helper method accepts constants via `Expr *` or placeholder
// value arguments to indicate which function arguments to forward to the
// builtin.
//
// If the method that is being built has a non-void return type the
-// finalizeMethod will create a return statent with the value of the last
-// statement (unless the last statement is already a ReturnStmt).
+// finalize() will create a return statement with the value of the last
+// statement (unless the last statement is already a ReturnStmt or the return
+// value is void).
struct BuiltinTypeMethodBuilder {
private:
- struct MethodParam {
+ struct Param {
const IdentifierInfo &NameII;
QualType Ty;
HLSLParamModifierAttr::Spelling Modifier;
- MethodParam(const IdentifierInfo &NameII, QualType Ty,
- HLSLParamModifierAttr::Spelling Modifier)
+ Param(const IdentifierInfo &NameII, QualType Ty,
+ HLSLParamModifierAttr::Spelling Modifier)
: NameII(NameII), Ty(Ty), Modifier(Modifier) {}
};
BuiltinTypeDeclBuilder &DeclBuilder;
- DeclarationNameInfo NameInfo;
+ DeclarationName Name;
QualType ReturnTy;
+ // method or constructor declaration (CXXConstructorDecl derives from
+ // CXXMethodDecl)
CXXMethodDecl *Method;
bool IsConst;
- llvm::SmallVector<MethodParam> Params;
+ bool IsConstructor;
+ llvm::SmallVector<Param> Params;
llvm::SmallVector<Stmt *> StmtsList;
// Argument placeholders, inspired by std::placeholder. These are the indices
@@ -122,15 +126,17 @@ struct BuiltinTypeMethodBuilder {
friend BuiltinTypeDeclBuilder;
BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB, DeclarationName &Name,
- QualType ReturnTy, bool IsConst = false)
- : DeclBuilder(DB), NameInfo(DeclarationNameInfo(Name, SourceLocation())),
- ReturnTy(ReturnTy), Method(nullptr), IsConst(IsConst) {}
-
- BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB, StringRef Name,
- QualType ReturnTy, bool IsConst = false);
+ QualType ReturnTy, bool IsConst = false,
+ bool IsConstructor = false)
+ : DeclBuilder(DB), Name(Name), ReturnTy(ReturnTy), Method(nullptr),
+ IsConst(IsConst), IsConstructor(IsConstructor) {}
+
+ BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB, StringRef NameStr,
+ QualType ReturnTy, bool IsConst = false,
+ bool IsConstructor = false);
BuiltinTypeMethodBuilder(const BuiltinTypeMethodBuilder &Other) = delete;
- ~BuiltinTypeMethodBuilder() { finalizeMethod(); }
+ ~BuiltinTypeMethodBuilder() { finalize(); }
BuiltinTypeMethodBuilder &
operator=(const BuiltinTypeMethodBuilder &Other) = delete;
@@ -144,11 +150,18 @@ struct BuiltinTypeMethodBuilder {
template <typename TLHS, typename TRHS>
BuiltinTypeMethodBuilder &assign(TLHS LHS, TRHS RHS);
template <typename T> BuiltinTypeMethodBuilder &dereference(T Ptr);
- BuiltinTypeDeclBuilder &finalizeMethod();
+ BuiltinTypeDeclBuilder &finalize();
Expr *getResourceHandleExpr();
private:
- void createMethodDecl();
+ void createDecl();
+
+ // Makes sure the declaration is created; should be called before any
+ // statement added or when access to 'this' is needed.
+ void ensureCompleteDecl() {
+ if (!Method)
+ createDecl();
+ }
};
TemplateParameterListBuilder::~TemplateParameterListBuilder() {
@@ -323,13 +336,26 @@ Expr *BuiltinTypeMethodBuilder::convertPlaceholder(PlaceHolder PH) {
}
BuiltinTypeMethodBuilder::BuiltinTypeMethodBuilder(BuiltinTypeDeclBuilder &DB,
- StringRef Name,
+ StringRef NameStr,
QualType ReturnTy,
- bool IsConst)
- : DeclBuilder(DB), ReturnTy(ReturnTy), Method(nullptr), IsConst(IsConst) {
- const IdentifierInfo &II =
- DB.SemaRef.getASTContext().Idents.get(Name, tok::TokenKind::identifier);
- NameInfo = DeclarationNameInfo(DeclarationName(&II), SourceLocation());
+ bool IsConst,
+ bool IsConstructor)
+ : DeclBuilder(DB), ReturnTy(ReturnTy), Method(nullptr), IsConst(IsConst),
+ IsConstructor(IsConstructor) {
+
+ assert((!NameStr.empty() || IsConstructor) && "method needs a name");
+ assert(((IsConstructor && !IsConst) || !IsConstructor) &&
+ "constructor cannot be const");
+
+ ASTContext &AST = DB.SemaRef.getASTContext();
+ if (IsConstructor) {
+ Name = AST.DeclarationNames.getCXXConstructorName(
+ DB.Record->getTypeForDecl()->getCanonicalTypeUnqualified());
+ } else {
+ const IdentifierInfo &II =
+ AST.Idents.get(NameStr, tok::TokenKind::identifier);
+ Name = DeclarationName(&II);
+ }
}
BuiltinTypeMethodBuilder &
@@ -342,13 +368,13 @@ BuiltinTypeMethodBuilder::addParam(StringRef Name, QualType Ty,
return *this;
}
-void BuiltinTypeMethodBuilder::createMethodDecl() {
- assert(Method == nullptr && "Method already created");
+void BuiltinTypeMethodBuilder::createDecl() {
+ assert(Method == nullptr && "Method or constructor is already created");
- // create method type
+ // create method or constructor type
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
SmallVector<QualType> ParamTypes;
- for (MethodParam &MP : Params)
+ for (Param &MP : Params)
ParamTypes.emplace_back(MP.Ty);
FunctionProtoType::ExtProtoInfo ExtInfo;
@@ -357,18 +383,27 @@ void BuiltinTypeMethodBuilder::createMethodDecl() {
QualType MethodTy = AST.getFunctionType(ReturnTy, ParamTypes, ExtInfo);
- // create method decl
+ // create method or constructor decl
auto *TSInfo = AST.getTrivialTypeSourceInfo(MethodTy, SourceLocation());
- Method = CXXMethodDecl::Create(
- AST, DeclBuilder.Record, SourceLocation(), NameInfo, MethodTy, TSInfo,
- SC_None, false, false, ConstexprSpecKind::Unspecified, SourceLocation());
+ DeclarationNameInfo NameInfo = DeclarationNameInfo(Name, SourceLocation());
+ if (IsConstructor)
+ Method = CXXConstructorDecl::Create(
+ AST, DeclBuilder.Record, SourceLocation(), NameInfo, MethodTy, TSInfo,
+ ExplicitSpecifier(), false, true, false,
+ ConstexprSpecKind::Unspecified);
+ else
+ Method =
+ CXXMethodDecl::Create(AST, DeclBuilder.Record, SourceLocation(),
+ NameInfo, MethodTy, TSInfo, SC_None, false, false,
+ ConstexprSpecKind::Unspecified, SourceLocation());
// create params & set them to the function prototype
SmallVector<ParmVarDecl *> ParmDecls;
+ unsigned CurScopeDepth = DeclBuilder.SemaRef.getCurScope()->getDepth();
auto FnProtoLoc =
Method->getTypeSourceInfo()->getTypeLoc().getAs<FunctionProtoTypeLoc>();
for (int I = 0, E = Params.size(); I != E; I++) {
- MethodParam &MP = Params[I];
+ Param &MP = Params[I];
ParmVarDecl *Parm = ParmVarDecl::Create(
AST, Method->getDeclContext(), SourceLocation(), SourceLocation(),
&MP.NameII, MP.Ty,
@@ -379,6 +414,7 @@ void BuiltinTypeMethodBuilder::createMethodDecl() {
HLSLParamModifierAttr::Create(AST, SourceRange(), MP.Modifier);
Parm->addAttr(Mod);
}
+ Parm->setScopeInfo(CurScopeDepth, I);
ParmDecls.push_back(Parm);
FnProtoLoc.setParam(I, Parm);
}
@@ -386,10 +422,7 @@ void BuiltinTypeMethodBuilder::createMethodDecl() {
}
Expr *BuiltinTypeMethodBuilder::getResourceHandleExpr() {
- // The first statement added to a method or access to 'this' creates the
- // declaration.
- if (!Method)
- createMethodDecl();
+ ensureCompleteDecl();
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
CXXThisExpr *This = CXXThisExpr::Create(
@@ -407,10 +440,7 @@ BuiltinTypeMethodBuilder::callBuiltin(StringRef BuiltinName,
std::array<Expr *, sizeof...(ArgSpecs)> Args{
convertPlaceholder(std::forward<Ts>(ArgSpecs))...};
- // The first statement added to a method or access to 'this` creates the
- // declaration.
- if (!Method)
- createMethodDecl();
+ ensureCompleteDecl();
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
FunctionDecl *FD = lookupBuiltinFunction(DeclBuilder.SemaRef, BuiltinName);
@@ -418,10 +448,14 @@ BuiltinTypeMethodBuilder::callBuiltin(StringRef BuiltinName,
AST, NestedNameSpecifierLoc(), SourceLocation(), FD, false,
FD->getNameInfo(), AST.BuiltinFnTy, VK_PRValue);
+ auto *ImpCast = ImplicitCastExpr::Create(
+ AST, AST.getPointerType(FD->getType()), CK_BuiltinFnToFnPtr, DRE, nullptr,
+ VK_PRValue, FPOptionsOverride());
+
if (ReturnType.isNull())
ReturnType = FD->getReturnType();
- Expr *Call = CallExpr::Create(AST, DRE, Args, ReturnType, VK_PRValue,
+ Expr *Call = CallExpr::Create(AST, ImpCast, Args, ReturnType, VK_PRValue,
SourceLocation(), FPOptionsOverride());
StmtsList.push_back(Call);
return *this;
@@ -451,11 +485,11 @@ BuiltinTypeMethodBuilder &BuiltinTypeMethodBuilder::dereference(T Ptr) {
return *this;
}
-BuiltinTypeDeclBuilder &BuiltinTypeMethodBuilder::finalizeMethod() {
+BuiltinTypeDeclBuilder &BuiltinTypeMethodBuilder::finalize() {
assert(!DeclBuilder.Record->isCompleteDefinition() &&
"record is already complete");
- assert(Method != nullptr &&
- "method decl not created; are you missing a call to build the body?");
+
+ ensureCompleteDecl();
if (!Method->hasBody()) {
ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
@@ -600,27 +634,39 @@ BuiltinTypeDeclBuilder::addHandleMember(ResourceClass RC, ResourceKind RK,
return *this;
}
+// Adds default constructor to the resource class:
+// Resource::Resource()
BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDefaultHandleConstructor() {
if (Record->isCompleteDefinition())
return *this;
- ASTContext &AST = Record->getASTContext();
- QualType ConstructorType =
- AST.getFunctionType(AST.VoidTy, {}, FunctionProtoType::ExtProtoInfo());
-
- CanQualType CanTy = Record->getTypeForDecl()->getCanonicalTypeUnqualified();
- DeclarationName Name = AST.DeclarationNames.getCXXConstructorName(CanTy);
- CXXConstructorDecl *Constructor = CXXConstructorDecl::Create(
- AST, Record, SourceLocation(),
- DeclarationNameInfo(Name, SourceLocation()), ConstructorType,
- AST.getTrivialTypeSourceInfo(ConstructorType, SourceLocation()),
- ExplicitSpecifier(), false, true, false, ConstexprSpecKind::Unspecified);
-
- Constructor->setBody(CompoundStmt::Create(
- AST, {}, FPOptionsOverride(), SourceLocation(), SourceLocation()));
- Constructor->setAccess(AccessSpecifier::AS_public);
- Record->addDecl(Constructor);
- return *this;
+ using PH = BuiltinTypeMethodBuilder::PlaceHolder;
+ return BuiltinTypeMethodBuilder(*this, "", SemaRef.getASTContext().VoidTy,
+ false, true)
+ .callBuiltin("__builtin_hlsl_resource_createpoisonhandle", QualType(),
+ PH::Handle)
+ .assign(PH::Handle, PH::LastStmt)
+ .finalize();
+}
+
+BuiltinTypeDeclBuilder &
+BuiltinTypeDeclBuilder::addHandleConstructorFromBinding() {
+ if (Record->isCompleteDefinition())
+ return *this;
+
+ using PH = BuiltinTypeMethodBuilder::PlaceHolder;
+ ASTContext &AST = SemaRef.getASTContext();
+ QualType HandleType = getResourceHandleField()->getType();
+
+ return BuiltinTypeMethodBuilder(*this, "", AST.VoidTy, false, true)
+ .addParam("spaceNo", AST.UnsignedIntTy)
+ .addParam("registerNo", AST.UnsignedIntTy)
+ .addParam("range", AST.IntTy)
+ .addParam("index", AST.UnsignedIntTy)
+ .callBuiltin("__builtin_hlsl_resource_createhandlefrombinding",
+ HandleType, PH::Handle, PH::_0, PH::_1, PH::_2, PH::_3)
+ .assign(PH::Handle, PH::LastStmt)
+ .finalize();
}
BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addArraySubscriptOperators() {
@@ -714,7 +760,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addIncrementCounterMethod() {
SemaRef.getASTContext().UnsignedIntTy)
.callBuiltin("__builtin_hlsl_buffer_update_counter", QualType(),
PH::Handle, getConstantIntExpr(1))
- .finalizeMethod();
+ .finalize();
}
BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDecrementCounterMethod() {
@@ -723,7 +769,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addDecrementCounterMethod() {
SemaRef.getASTContext().UnsignedIntTy)
.callBuiltin("__builtin_hlsl_buffer_update_counter", QualType(),
PH::Handle, getConstantIntExpr(-1))
- .finalizeMethod();
+ .finalize();
}
BuiltinTypeDeclBuilder &
@@ -747,7 +793,7 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name,
.callBuiltin("__builtin_hlsl_resource_getpointer", ElemPtrTy, PH::Handle,
PH::_0)
.dereference(PH::LastStmt)
- .finalizeMethod();
+ .finalize();
}
BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() {
@@ -762,7 +808,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() {
AST.getPointerType(ElemTy), PH::Handle, PH::LastStmt)
.dereference(PH::LastStmt)
.assign(PH::LastStmt, PH::_0)
- .finalizeMethod();
+ .finalize();
}
BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod() {
@@ -775,7 +821,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addConsumeMethod() {
.callBuiltin("__builtin_hlsl_resource_getpointer",
AST.getPointerType(ElemTy), PH::Handle, PH::LastStmt)
.dereference(PH::LastStmt)
- .finalizeMethod();
+ .finalize();
}
} // namespace hlsl
diff --git a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
index 2c944c4a60038..2d3abb6055669 100644
--- a/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
+++ b/clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.h
@@ -74,6 +74,7 @@ class BuiltinTypeDeclBuilder {
// Builtin types methods
BuiltinTypeDeclBuilder &addDefaultHandleConstructor();
+ BuiltinTypeDeclBuilder &addHandleConstructorFromBinding();
// Builtin types methods
BuiltinTypeDeclBuilder &addLoadMethods();
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index 9224f12f2d025..7b477249de0a7 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -131,7 +131,8 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S,
bool IsROV, bool RawBuffer) {
return BuiltinTypeDeclBuilder(S, Decl)
.addHandleMember(RC, RK, IsROV, RawBuffer)
- .addDefaultHandleConstructor();
+ .addDefaultHandleConstructor()
+ .addHandleConstructorFromBinding();
}
// This function is responsible for constructing the constraint expression for
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9c67fbd40ac71..b56f0b36b390e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -14340,10 +14340,8 @@ void Sema::ActOnUni...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/132453
More information about the llvm-branch-commits
mailing list