[PATCH] D131625: [HLSL] Entry functions require param annotation

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 06:22:40 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/AST/Attr.h:193
 
+class HLSLAnnotationAttr : public InheritableAttr {
+protected:
----------------
Is this intended to be used only for parameters (that's how I read the summary for the patch)? If so, why is this not inheriting from `InheritableParamAttr`?


================
Comment at: clang/include/clang/AST/Attr.h:195-197
+  HLSLAnnotationAttr(ASTContext &Context,
+                       const AttributeCommonInfo &CommonInfo, attr::Kind AK,
+                       bool IsLateParsed, bool InheritEvenIfAlreadyPresent)
----------------
Formatting looks off here, you should run the patch through clang-format.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:11635
 def err_hlsl_attribute_param_mismatch : Error<"%0 attribute parameters do not match the previous declaration">;
+def err_hlsl_missing_parameter_annotation : Error<"entry function parameter %0 missing annotation">;
 
----------------
Will users know how to fix the issue when they get this diagnostic? "missing annotation" sounds like "slap any old annotation on there, it'll be fine".


================
Comment at: clang/lib/Sema/SemaDecl.cpp:11874
+
+  for (const auto Param : FD->parameters()) {
+    if (!Param->hasAttr<HLSLAnnotationAttr>()) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131625/new/

https://reviews.llvm.org/D131625



More information about the cfe-commits mailing list