[PATCH] D68028: [clang] Add no_builtin attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 05:56:14 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:4407
+It accepts one or more strings corresponding to the name of the builtin
+(e.g. "memcpy", "memset") or "*" which disables all builtins at once.
+
----------------
This mention of `*` is now out of date.


================
Comment at: clang/include/clang/Basic/AttrDocs.td:4412
+  // The compiler is not allowed to add any builtin to foo's body.
+  void foo(char* data, size_t count) __attribute__((no_builtin("*"))) {
+    // The compiler is not allowed to convert the loop into
----------------
This one too.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:3609
+  "'%0' is not a valid builtin name for %1">,
+  InGroup<IgnoredAttributes>; // Which group should it be in?
+def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
----------------
Hmm, I thought there was a way you could do:
```
InGroup<DiagGroup<"invalid-no-builtin-names", IgnoredAttributes>>;
```
but it seems I've got the order reversed and you'd have to add a new diagnostic group that `IgnoredAttributes` could subsume. We don't do that for other attributes, so I think you should just do:
```
InGroup<DiagGroup<"invalid-no-builtin-names">>;
```
(Feel free to pick a better diagnostic group name if you have a better idea, I'm not tied to my suggestion.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68028





More information about the cfe-commits mailing list