[PATCH] D22770: [Sema, NFC] Reset HasFallthroughStmt when clearing FunctionScopeInfo

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 08:44:00 PST 2016


arphaman added a comment.

I looked at the way `HasFallthroughStmt` is used, and it didn't seem so, no. It's used in the following manner in AnalysisBasedWarnings.cpp:

  bool FallThroughDiagFull =
      !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getLocStart());
  bool FallThroughDiagPerFunction = !Diags.isIgnored(
      diag::warn_unannotated_fallthrough_per_function, D->getLocStart());
  if (FallThroughDiagFull || FallThroughDiagPerFunction ||
      fscope->HasFallthroughStmt) {
    DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull);
  }

So it seems to me that even if `HasFallthroughStmt` isn't cleared, the analysis won't show up anything different for a function that re-used the scope info, because when diagnostics are ignored and the flag actually leads to incorrect call to `DiagnoseSwitchLabelsFallthrough `, the analysis won't show any warnings since the diagnostics are ignored. And likewise if one of the diagnostics is enabled then it doesn't matter if `HasFallthroughStmt` is true, so we won't be able to observe a difference there.


https://reviews.llvm.org/D22770





More information about the cfe-commits mailing list