================
@@ -3350,6 +3350,44 @@ static bool CheckVectorSelect(Sema *S, CallExpr
*TheCall) {
return false;
}
+static bool CheckIndexType(Sema *S, CallExpr *TheCall, unsigned IndexArgIndex)
{
+ assert(TheCall->getNumArgs() > IndexArgIndex && "Index argument missing");
+ QualType ArgType = TheCall->getArg(IndexArgIndex)->getType();
+ QualType IndexTy = ArgType;
+ unsigned int ActualDim = 1;
+ if (const auto *VTy = IndexTy->getAs<VectorType>()) {
+ ActualDim = VTy->getNumElements();
+ IndexTy = VTy->getElementType();
+ }
+ if (!IndexTy->isIntegerType()) {
+ S->Diag(TheCall->getArg(IndexArgIndex)->getBeginLoc(),
+ diag::err_typecheck_expect_int)
+ << ArgType;
+ return true;
+ }
+
+ QualType ResourceArgTy = TheCall->getArg(0)->getType();
+ const HLSLAttributedResourceType *ResTy =
+ ResourceArgTy.getTypePtr()->getAs<HLSLAttributedResourceType>();
+ assert(ResTy && "Resource argument must be a resource");
+ HLSLAttributedResourceType::Attributes ResAttrs = ResTy->getAttrs();
+
+ unsigned int ExpectedDim = 1;
+ if (ResAttrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown) {
+ ExpectedDim = getResourceDimensions(ResAttrs.ResourceDimension);
+ }
----------------
hekota wrote:
```suggestion
if (ResAttrs.ResourceDimension != llvm::dxil::ResourceDimension::Unknown)
ExpectedDim = getResourceDimensions(ResAttrs.ResourceDimension);
```
https://github.com/llvm/llvm-project/pull/186110
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits