Anastasia added a comment. In D96853#2577172 <https://reviews.llvm.org/D96853#2577172>, @benshi001 wrote:
> In D96853#2577133 <https://reviews.llvm.org/D96853#2577133>, @aykevl wrote: > >> I am not very familiar with Clang so I can't say much about it. Although I >> wonder whether a macro is the right way to implement this? Is there >> something similar in other targets? (GPUs tend to have lots of address >> spaces, you could take a look there). > > A macro definition is the simplest way, an alias to > `__attribute__((address_space(0)))`. I do not find any other easy way for a > plain keyword `__flash`. Ok, macro could be a reasonable direction. This is how clang implements address spaces for CUDA. Another option is adding a keyword. OpenCL implements address spaces this way. You can't add a target-specific keyword but considering that it start with "__" it should be reasonable to add this to C/C++ mode. You could for example align with gcc implementation. I am guessing this will only be supported by 1 target in clang? Then target address spaces make sense otherwise you can also extend the language address space enum. Are you also planning to add `__flashN`? https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html ================ Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:2995 +def err_qualifier_with_address_space : Error< + "qualifier '%select{const|volatile}0' %select{needed|invalid}1 " + "for variables in address space '%2'">; ---------------- Minor wording change: ``` qualifier '%select{const|volatile}0' is %select{needed|invalid}1 ``` Could you not use the same parameter in select twice i.e. ``` qualifier '%select{const|volatile}0' is %select{needed|invalid}0 ``` ? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D96853/new/ https://reviews.llvm.org/D96853 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits