AaronBallman wrote:

> I am a bit concerned about what will happen with those new attributes later 
> in the lifetime analysis, wouldn't it be hard to manage all those 4 
> attributes when they are doing practically the same thing?

We usually do this via accessors like: 
https://github.com/llvm/llvm-project/blob/1cec7b0c4b24db0bced646e57cc60cf496483fcf/clang/include/clang/Basic/Attr.td#L898

This way you can have one semantic attribute with multiple spellings but can 
still be easily differentiated when needed. Things which care about whether 
there's any lifetime_capture_by would continue to use 
`hasAttr<LifetimeCaptureByAttr>` and things which need to care about the 
particular form of the attribute would use `if (const auto *A = 
D->getAttr<LifetimeCaptureByAttr>(); A && A->isGlobal())` (or whatever accessor 
is important).

https://github.com/llvm/llvm-project/pull/196635
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to