[all-commits] [llvm/llvm-project] 843390: Apply proper source location to fallthrough switch...

adrian-prantl via All-commits all-commits at lists.llvm.org
Fri Sep 17 14:45:21 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 843390c58ae660fa356c534fdc8b19756f8d175c
      https://github.com/llvm/llvm-project/commit/843390c58ae660fa356c534fdc8b19756f8d175c
  Author: Adrian Prantl <aprantl at apple.com>
  Date:   2021-09-17 (Fri, 17 Sep 2021)

  Changed paths:
    M clang/lib/CodeGen/CGStmt.cpp
    A clang/test/CodeGen/debug-info-switch-fallthrough.c

  Log Message:
  -----------
  Apply proper source location to fallthrough switch cases.

This fixes a bug in clang where, when clang sees a switch with a
fallthrough to a default like this:

static void funcA(void) {}
static void funcB(void) {}

int main(int argc, char **argv) {

switch (argc) {
    case 0:
        funcA();
        break;
    case 10:
    default:
        funcB();
        break;
}
}

It does not add a proper debug location for that switch case, such as
case 10: above.

Patch by Shubham Rastogi!

Differential Revision: https://reviews.llvm.org/D109940




More information about the All-commits mailing list