[clang] [llvm] [HLSL] Add implicit resource element type concepts to AST (PR #116413)
Joshua Batista via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 11:45:40 PST 2024
================
@@ -5720,8 +5720,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
case UTT_IsTypedResourceElementCompatible:
assert(Self.getLangOpts().HLSL &&
"typed resource element compatible types are an HLSL-only feature");
- if (Self.RequireCompleteType(TInfo->getTypeLoc().getBeginLoc(), T,
- diag::err_incomplete_type))
+ if (T->isIncompleteType())
----------------
bob80905 wrote:
Consider `RWBuffer<TemplatedBuffer<int> > r8;`
If we left the old condition as it was, then in evaluating the outer RWBuffer, we'd need to require that the inner element type `TemplatedBuffer<int>` is a complete type. It is not yet, however. But we don't need to require that the element type is complete, because the type trait already rejects incomplete types.
Requiring that condition caused assertion errors IIRC when recursing into deeper element types that aren't yet complete. Types would attempt to be completed earlier than necessary. This is unnecessary since the type trait itself will return false on incomplete types.
"The only allowed types are builtin types or vectors (which are builtin), any incomplete type is guaranteed to not conform to the concept."
https://github.com/llvm/llvm-project/pull/116413
More information about the llvm-commits
mailing list