[PATCH] D145842: [clang][Sema] Avoid duplicate diagnostics for unreachable fallthrough attribute

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 11 03:01:02 PST 2023


hazohelet created this revision.
hazohelet added reviewers: tbaeder, aaron.ballman, cjdb.
Herald added a reviewer: NoQ.
Herald added a project: All.
hazohelet requested review of this revision.
Herald added a project: clang.

This patch checks whether `-Wunreachable-code-fallthrough` is enabled when clang encounters unreachable fallthrough attributes and, if so, suppresses `code will never be executed` warning to avoid duplicate warnings.
This fixes https://github.com/llvm/llvm-project/issues/60416


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145842

Files:
  clang/include/clang/Analysis/Analyses/ReachableCode.h
  clang/lib/Analysis/ReachableCode.cpp
  clang/lib/Sema/AnalysisBasedWarnings.cpp
  clang/test/Sema/warn-unreachable-fallthrough.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145842.504347.patch
Type: text/x-patch
Size: 6068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230311/e23f2497/attachment.bin>


More information about the cfe-commits mailing list