[clang] [Clang][TableGen] Support specifying address space in clang builtin prototypes (PR #108497)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 08:12:47 PDT 2024


AaronBallman wrote:

> Gentle ping @AaronBallman , @philnik777 , @fpetrogalli :)

Ah, sorry -- because the PR is marked as a Draft, I figured it wasn't ready for review yet.

I think I'd rather this was expressed differently; we already don't put attribute information in the prototype anyway (`noexcept` as an example), so I'd prefer to continue down that road and put the address space information into the `Attributes` field. e.g.,
```
def BuiltinCPUIs : Builtin {
  let Spellings = ["__builtin_cpu_is"];
  let Attributes = [NoThrow, Const, AddressSpace<2>];
  let Prototype = "bool(char const*)";
}
```
I think that makes it more clean in terms of specifying the attribute, and it also means we can name the address spaces in `BuiltinsBase.td` if we would like, which is even easier for folks to understand when reading `Builtins.td`

WDYT?

https://github.com/llvm/llvm-project/pull/108497


More information about the cfe-commits mailing list