[clang] [HLSL] Implement Texture2D::mips[][] (PR #186143)
Nathan Gauër via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 25 07:08:15 PDT 2026
================
@@ -5132,7 +5132,45 @@ void SemaHLSL::handleGlobalStructOrArrayOfWithResources(VarDecl *VD) {
}
}
+bool SemaHLSL::CheckForMipsIntermediateType(QualType T, SourceLocation Loc) {
+ const auto *RT = T->getAs<RecordType>();
+ if (!RT)
+ return false;
+
+ const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
+ if (!RD || !RD->isImplicit())
+ return false;
+
+ const DeclContext *DC = RD->getDeclContext();
+ const auto *ParentRD = dyn_cast<CXXRecordDecl>(DC);
+ if (!ParentRD)
+ return false;
+
+ const DeclContext *ParentDC = ParentRD->getDeclContext();
+ QualType ParentTy =
+ SemaRef.getASTContext().getTypeDeclType(cast<TypeDecl>(ParentRD));
+ if (!ParentTy->isHLSLResourceRecord()) {
+ return false;
+ }
+
+ if (!ParentDC->isNamespace() &&
----------------
Keenuts wrote:
`!isNamespace && cast<>` ? Seems like the isNamespace is never true otherwise it would crash no?
https://github.com/llvm/llvm-project/pull/186143
More information about the cfe-commits
mailing list