[llvm] [nfc] Common utility macros for `Error` / `Expect<T>` (PR #92150)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 17:56:08 PDT 2024


lhames wrote:

> Might be worth a discourse post, if you haven't already made one - while the implementation isn't huge/complex, the ramifications for how code across LLVM is written are not insignificant.

Yeah -- this is worth some community discussion.

> I'd advocate for an LLVM_* prefix, because we'll end up using these in headers and won't want to conflict with code that uses LLVM as a library.

I agree these should have an `LLVM_` prefix to avoid conflicts.

At that point I'm not sure the macros improve readability enough to justify introducing them as a common utility, but I don't have strong feelings about this.

> Wouldn't mind more context on how these compare to existing/other solutions, like the one in proto/google linked
> 
> Oh, I'd probably do this in two steps - one to introduce the macros and tests for them (& I'd suggest that shouldn't be labeled NFC - we don't usually label core/generic API additions/changes as NFC) and then a separate NFC commit that migrates existing code to use the API.

Agree on using separate commits for introduction and adoption if we did decide to move ahead with this.



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


More information about the llvm-commits mailing list