Author: Kit Dallege Date: 2026-03-15T19:31:54Z New Revision: 906f2b6cff72c5276f33eb9c30226d0fa6d5cfa1
URL: https://github.com/llvm/llvm-project/commit/906f2b6cff72c5276f33eb9c30226d0fa6d5cfa1 DIFF: https://github.com/llvm/llvm-project/commit/906f2b6cff72c5276f33eb9c30226d0fa6d5cfa1.diff LOG: [Clang][Docs] Clarify [[unlikely]] example in compound statement (#186590) The first code example in the "confusing standard behavior" section had a comment claiming `[[unlikely]]` makes the branch unlikely, contradicting a later example showing the same placement being ignored. Rewords the comment to clarify this is the C++ Standard's recommendation that Clang does not follow, since the attribute is not on the substatement. Continues the work from #126372. Fixes #126362. Added: Modified: clang/include/clang/Basic/AttrDocs.td Removed: ################################################################################ diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 718df8c7154a2..0c5a15e610114 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2686,8 +2686,10 @@ path of execution, but that can be confusing: .. code-block:: c++ if (b) { - [[unlikely]] --b; // In the path of execution, - // this branch is considered unlikely. + [[unlikely]] --b; // Per the standard this is in the path of + // execution, so this branch should be considered + // unlikely. However, Clang ignores the attribute + // here since it is not on the substatement. } if (b) { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
