[clang] [Clang] Fix false-positive fallthrough warning (#230802) (PR #234848)

Adinesh Reddy via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 23 03:17:09 PDT 2026


================
@@ -253,6 +253,82 @@ int fallthrough_covered_enums(Enum e) {
   return n;
 }
 
+// Attributes on consecutive switch labels should not introduce false fallthrough.
+int fallthrough_attributed_labels(int n) {
+  switch (n) {
+  [[unlikely]] case 0:
+  [[unlikely]] case 1:
+  [[likely]] case 2:
+  case 3:
+    return 0;
+  [[unlikely]] default:
----------------
Adinesh-Reddy wrote:

i have updated the test ,prserves the original structure.


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


More information about the cfe-commits mailing list