llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Kit Dallege (kovan)

<details>
<summary>Changes</summary>

## Summary
- 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
- The code example is kept unchanged — the contradiction was in the comment, 
not the code

Fixes #<!-- -->126362
Continues the work from #<!-- -->126372 (reviewer feedback from @<!-- 
-->Sirraide and @<!-- -->AaronBallman indicated the fix should reword the 
comment rather than move the attribute)

---
Full diff: https://github.com/llvm/llvm-project/pull/186590.diff


1 Files Affected:

- (modified) clang/include/clang/Basic/AttrDocs.td (+4-2) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/186590
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to