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

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 05:28:13 PST 2024


================
@@ -1996,6 +1996,30 @@ Here is an example:
   }];
 }
 
+def AssumeDocs : Documentation {
+  let Category = DocCatStmt;
+  let Heading = "assume";
+  let Content = [{
+The ``assume`` attribute is used to indicate to the optimizer that a
+certain condition can be assumed to be true at a certain point in the
+program. If this condition is violated at runtime, the behavior is
----------------
cor3ntin wrote:

Do we want to add some caveat to the docs?

"Note that due to the way the optimizer works, [[assume]] can affect performance negatively. It should be used with parsimony and care"

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


More information about the cfe-commits mailing list