[clang] [Clang][C++23] Implement P1774R8: Portable assumptions (PR #81014)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 09:57:00 PST 2024


erichkeane wrote:

>I suppose the only question now is whether [[clang::assume]] should be treated like [[assume]] if it’s not applied to a function declaration?

THAT is an interesting question that @AaronBallman might have some comments on...

Effectively, we have TWO 'assume' attributes-
1- An openmp FunctionDecl attribute that takes a string
2- The standard 'statement' attribute that takes an expression.

So the question is, how do we differentiate between the two?  We have a few options:
1- spelling: `[[clang::assume]]`/`__attribute__((assume))` currently work for the 'string' version, so make ONLY `[[assume]]` the C++ one.
2- Argument: The OMP one takes a string argument, we take an expression.  Bifurcate based on that?
3- Appertainment: OMP is a function decl, standard is a statement.

Of the three, I lean towards 3 actually, I think that is perhaps the BEST idea, and is perhaps supported by our existing infrastructure already (if you have Attr.td set its targets right?).  I'd like to see what Aaron has to say, but I THINK that is my preference baring any concerns.

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


More information about the cfe-commits mailing list