[clang] [HLSL] Remove support for constructors for user defined structs (PR #190089)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 12:42:20 PDT 2026
================
@@ -976,17 +977,21 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
PD->getAttr<HLSLParamModifierAttr>()) {
llvm_unreachable("Not handled yet");
} else {
- llvm::Type *ParamType =
- Param.hasByValAttr() ? Param.getParamByValType() : Param.getType();
+ llvm::Type *ParamType = Param.hasByValAttr() ? Param.getParamByValType()
+ : PD->getType()->isRecordType()
+ ? CGM.getTypes().ConvertType(PD->getType())
+ : Param.getType();
auto AttrBegin = PD->specific_attr_begin<HLSLAppliedSemanticAttr>();
auto AttrEnd = PD->specific_attr_end<HLSLAppliedSemanticAttr>();
auto Result =
handleSemanticLoad(B, FD, ParamType, PD, AttrBegin, AttrEnd);
SemanticValue = Result.first;
if (!SemanticValue)
return;
- if (Param.hasByValAttr()) {
- llvm::Value *Var = B.CreateAlloca(Param.getParamByValType());
+ // if this is a ptr to a record and it does'nt have byval attr
+ // we still need the record type not just 'ptr'
----------------
hekota wrote:
Nit - typo, and all comments should be full sentences. Applies to other comments in this PR as well.
```suggestion
// If this is a 'ptr' to a record and it doesn't have byval attribute,
// we still need the record type, not just 'ptr'.
```
https://github.com/llvm/llvm-project/pull/190089
More information about the cfe-commits
mailing list