================
@@ -73,6 +73,13 @@ def Constexpr : Attribute<"E">;
 // Builtin is immediate and must be constant evaluated. Implies Constexpr, and 
will only be supported in C++20 mode.
 def Consteval : Attribute<"EG">;
 
+// Address space attribute, only valid for pointer or reference arguments.
+// ArgIdx - argument to which the attribute refers. value 0 is for return type.
+// AddrSpaceNum - Address space number for the argument.
+class AddressSpace<int ArgIdx, int AddrSpaceNum> : IndexedAttribute<"", 
ArgIdx> {
----------------
AaronBallman wrote:

Instead of taking an `int` for the second argument, I think it would make more 
sense to do:
```
class AddressSpace<int AddrSpaceValue> {
  int SpaceNum = AddrSpaceValue;
}

// Use whatever the correct values are, I just used random numbers
def Global : AddressSpace<12>;
def Constant : AddressSpace<1002>;

class ArgWithAddressSpace<int ArgIdx, AddressSpace Num> : IndexedAttribute<"", 
ArgIdx< {
  AddressSpace AddrSpace = Num;
}
...
let Attributes = [ArgWithAddressSpace<0, Global>, NoThrow];
```
WDYT?

https://github.com/llvm/llvm-project/pull/108497
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to