[clang] [clang][Sema] Combine fallout warnings to just one warning (PR #127546)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 18 12:44:09 PST 2025


================
@@ -544,25 +544,17 @@ static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) {
 namespace {
 
 struct CheckFallThroughDiagnostics {
-  unsigned diag_MaybeFallThrough_HasNoReturn;
-  unsigned diag_MaybeFallThrough_ReturnsNonVoid;
-  unsigned diag_AlwaysFallThrough_HasNoReturn;
-  unsigned diag_AlwaysFallThrough_ReturnsNonVoid;
+  unsigned diag_FallThrough_HasNoReturn;
+  unsigned diag_FallThrough_ReturnsNonVoid;
   unsigned diag_NeverFallThroughOrReturn;
----------------
Sirraide wrote:

While we’re at it, could you do a small cleanup pass here and just default these diag IDs to `0` (i.e. `= 0` here) and then only assign a value to the ones we care about in each of the ctors instead of having `= 0` there all over the place. That’d prevent us from accidentally forgetting to initialise one of these.

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


More information about the cfe-commits mailing list