diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 77e995b4c933..b3f1e208fa31 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -5051,6 +5051,7 @@ void ItaniumCXXABI::emitBeginCatch(CodeGenFunction &CGF, // Emit the local. CodeGenFunction::AutoVarEmission var = CGF.EmitAutoVarAlloca(*CatchParam); + ApplyAtomGroup Grp(CGF.getDebugInfo()); InitCatchParam(CGF, *CatchParam, var.getObjectAddress(CGF), S->getBeginLoc()); CGF.EmitAutoVarCleanups(var); } diff --git a/clang/test/KeyInstructions/try-catch.cpp b/clang/test/KeyInstructions/try-catch.cpp new file mode 100644 index 000000000000..3d1080aca2f0 --- /dev/null +++ b/clang/test/KeyInstructions/try-catch.cpp @@ -0,0 +1,20 @@ +// RUN: %clang -gkey-instructions %s -gmlt -S -emit-llvm -o - -fexceptions \ +// RUN: | FileCheck %s + +void except() { + // FIXME(OCH): Should `store i32 32, ptr %exception` be key? + throw 32; +} + +void attempt() { + try { except(); } +// CHECK: catch: +// CHECK: %4 = call ptr @__cxa_begin_catch(ptr %exn) +// CHECK: %5 = load i32{{.*}}, !dbg [[G1R2:!.*]] +// CHECK: store i32 %5, ptr %e{{.*}}, !dbg [[G1R1:!.*]] +// CHECK: call void @__cxa_end_catch() + catch (int e) { } +} + +// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2) +// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)