george.burgess.iv added a comment.

Glad you like it!

> The second thing that would be amazing if this attribute was late parsed so 
> it the ability to reference this when applied to member functions

That seems like a good idea; I'll look into what that would take. (In the 
meantime, reviews would be appreciated. :) )

> If the condition could be evaluated as-if it were part of the function body 
> (during constexpr evaluation) that would be incredibly powerful. Especially 
> within the STL where everything is constexpr.

Honestly, if we could take this attribute and turn it into a full-fledged 
precondition attribute (that optionally acts as if it's a part of the function, 
optionally emits dynamic checks, ...), I'd be thrilled. If the community thinks 
that'd be a good idea, I'm happy to poke at it + incrementally build off of 
this in order to make that*. That said, I think all of that is going to require 
a fair bit more code and design thought to get right, and `diagnose_if` is 
useful enough as-is to stand on its own IMO.

IOW, we need to start somewhere, and this is a minimial-ish feature set that I 
think would be useful.

∗ - We can do this in a non-breaking way by either introducing an independent 
`precondition` attribute that heavily piggybacks off of `diagnose_if`, or we 
can add diagnostic modes + flags to `diagnose_if` (e.g. can have `warning`, 
`error`, `static-precondition`, `dynamic-precondition`, ...).


https://reviews.llvm.org/D27424



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to