Index: clang/lib/CodeGen/CGStmt.cpp =================================================================== --- clang/lib/CodeGen/CGStmt.cpp +++ clang/lib/CodeGen/CGStmt.cpp @@ -1518,6 +1518,11 @@ NextCase = dyn_cast(CurCase->getSubStmt()); } + // Generate a stop point for debug info if the case statement is followed + // by a default statement. + if (CurCase->getSubStmt()->getStmtClass() == Stmt::DefaultStmtClass) { + EmitStopPoint(CurCase); + } // Normal default recursion for non-cases. EmitStmt(CurCase->getSubStmt()); } Index: clang/test/CodeGen/switch-fallthrough.c =================================================================== --- /dev/null +++ clang/test/CodeGen/switch-fallthrough.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx11.0.0 -debug-info-kind=standalone -emit-llvm %s -o - | FileCheck %s +// CHECK: ], !dbg !{{[0-9]+}} +// CHECK-EMPTY: +// CHECK-NEXT: {{.+}} +// CHECK-NEXT: br {{.+}}, !dbg !{{[0-9+]}} +// CHECK-EMPTY: +// CHECK-NEXT: {{.+}} +// CHECK-NEXT: br {{.+}}, !dbg ![[LOC:[0-9]+]] +void test(int num) { + switch (num) { + case 0: + break; + case 10: // CHECK: ![[LOC]] = !DILocation(line: [[@LINE]], column:{{.+}}, scope: {{.+}}) + default: + break; + } +} \ No newline at end of file