[PATCH] D114439: [Annotation] Allow parameter pack expansions and initializer lists in annotate attribute

Steffen Larsen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 07:56:54 PST 2022


steffenlarsen added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4202
+  // If the first argument is value dependent we delay setting the arguments.
+  if (AllArgs.size() && AllArgs[0]->isValueDependent()) {
+    auto *Attr = AnnotateAttr::CreateWithDelayedArgs(
----------------
erichkeane wrote:
> if AllArgs.size() == 0, this is an error case.  Annotate requires at least 1 parameter.
I removed the check but thinking about it again I think it would be better to reintroduce it and let `HandleAnnotateAttr` call `checkAtLeastNumArgs`. That way it will also complain about missing arguments after template instantiation, e.g. if a lone pack expansion argument evaluates to an empty expression list.


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

https://reviews.llvm.org/D114439



More information about the cfe-commits mailing list