[clang] [HLSL] Add testing for space parameter on global constants (PR #106782)
Joshua Batista via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 12 16:37:27 PDT 2024
================
@@ -817,8 +821,12 @@ static void DiagnoseHLSLRegisterAttribute(Sema &S, SourceLocation &ArgLoc,
S.Diag(TheDecl->getLocation(),
diag::warn_hlsl_user_defined_type_missing_member)
<< regTypeNum;
-
- return;
+ // Space argument cannot be specified for global constants
+ if (!isDeclaredWithinCOrTBuffer(TheDecl)) {
----------------
bob80905 wrote:
The diagnostic implies that space can only be specified on non-global constants. The reason that condition is needed is so that we ensure that the attribute is applied on a non-global decl. I've added 2 tests to exercise this behavior.
https://github.com/llvm/llvm-project/pull/106782
More information about the cfe-commits
mailing list