[PATCH] D128249: Adding clone_attrs attribute.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 04:15:30 PDT 2022


aaron.ballman added a comment.

Can you add some details to the patch summary as to what problem you're trying to solve with these changes?

The idea itself has some interesting edge cases to think about:

  [[some_attr]] void decl();
  [[clone_attrs_from(decl)]] void other();
  [[some_new_attr]] void decl();
  
  int main() {
    other(); // Does other see some_new_attr as well?
  }

or

  [[hot]] void decl();
  [[clone_attrs_from(decl), cold]] void other_decl(); // Do you properly catch the mutual exclusions?

or

  [[some_attr_requiring_the_func_return_a_pointer]] int *decl();
  [[clone_attrs_from(decl)]] int other(); // Do you properly catch the semantic restrictions?

or

  struct [[some_struct_attr]] S { ... };
  [[clone_attrs_from(S)]] void other(); // Do you properly catch the semantic restrictions?

or

  [[some_attr]] void decl();
  [[clone_attrs_from(decl)]] void decl(); // Uh oh, recursive.

(I'm sure there are more situations I'm missing, but you get the idea about needing to be very careful with the edge cases.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128249



More information about the cfe-commits mailing list