[clang] [llvm] [HLSL] AST support for WaveSize attribute. (PR #101240)

Xiang Li via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 13:05:03 PDT 2024


================
@@ -144,6 +145,25 @@ HLSLNumThreadsAttr *SemaHLSL::mergeNumThreadsAttr(Decl *D,
       HLSLNumThreadsAttr(getASTContext(), AL, X, Y, Z);
 }
 
+HLSLWaveSizeAttr *SemaHLSL::mergeWaveSizeAttr(Decl *D,
+                                              const AttributeCommonInfo &AL,
+                                              int Min, int Max, int Preferred,
+                                              int SpelledArgsCount) {
+  if (HLSLWaveSizeAttr *NT = D->getAttr<HLSLWaveSizeAttr>()) {
+    if (NT->getMin() != Min || NT->getMax() != Max ||
+        NT->getPreferred() != Preferred ||
+        NT->getSpelledArgsCount() != SpelledArgsCount) {
+      Diag(NT->getLocation(), diag::err_hlsl_attribute_param_mismatch) << AL;
+      Diag(AL.getLoc(), diag::note_conflicting_attribute);
+    }
+    return nullptr;
----------------
python3kgae wrote:

It only ignores when the value matches.
If not match, error will be reported.


https://github.com/llvm/llvm-project/pull/101240


More information about the cfe-commits mailing list