[PATCH] D95695: [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 07:15:01 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang/test/AST/ast-print-attr.c:31
+// CHECK: int fun_annotate() __attribute__((annotate("annotation")))
+int fun_annotate() __attribute__((annotate("annotation")));
----------------
Can you add a second test that shows we properly print the comma? e.g., `int fun_annotate2() __attribute__((annotate("annotation one", "annotation two")));`


================
Comment at: clang/utils/TableGen/ClangAttrEmitter.cpp:2252
+  // Helper to print the starting character of an attribute argument. If there
+  // hasn't been an argument yet, it prints an opening parenthese; otherwise it
+  // prints a comma.
----------------
One downside to printing the opening paren is that this can't be used in a generic way for generating any comma-separate list. That said, I think this functionality is clean -- perhaps renaming the function from `Comma` to `PrintAttributeArgListElement` or something would be an improvement?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95695



More information about the cfe-commits mailing list