================ @@ -2163,6 +2163,51 @@ static void BuildFlattenedTypeList(QualType BaseTy, } } +bool SemaHLSL::IsLineVectorLayoutCompatibleType(clang::QualType QT) { + if (QT.isNull()) + return false; + + llvm::SmallVector<QualType, 16> QTTypes; + BuildFlattenedTypeList(QT, QTTypes); + + assert(QTTypes.size() > 0 && + "expected at least one constituent type from non-null type"); + QualType FirstQT = QTTypes[0]; + + // element count cannot exceed 4 + if (QTTypes.size() > 4) + return false; + + // check if the outer type was an array type + if (llvm::isa<clang::ArrayType>(QT.getTypePtr())) + return false; + + for (QualType TempQT : QTTypes) { + // ensure homogeneity + if (TempQT != FirstQT) + return false; + + if (const BuiltinType *BT = TempQT->getAs<BuiltinType>()) { + if (BT->getKind() == BuiltinType::Bool || + BT->getKind() == BuiltinType::Enum) + return false; + + // Check if it is an array type. + if (llvm::isa<clang::ArrayType>(TempQT.getTypePtr())) ---------------- hekota wrote:
```suggestion if (TempQT->isArrayType()) ``` https://github.com/llvm/llvm-project/pull/113730 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits