diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 137c69420ddf6685342ce3441594ee7da5a5127e..e142a21b1e744652d5366e0e5a0ca3a6e4c62b86 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -112,9 +112,8 @@ CodeGenFunction::~CodeGenFunction() { if (FirstBlockInfo) destroyBlockInfos(FirstBlockInfo); - if (getLangOpts().OpenMP) { + if (getLangOpts().OpenMP && CurFn) CGM.getOpenMPRuntime().functionFinished(*this); - } } CharUnits CodeGenFunction::getNaturalPointeeTypeAlignment(QualType T, diff --git a/test/OpenMP/openmp_seh.c b/test/OpenMP/openmp_seh.c new file mode 100644 index 0000000000000000000000000000000000000000..74dccec125e3dd5f13d883d5c005e3780df5ea80 --- /dev/null +++ b/test/OpenMP/openmp_seh.c @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -verify -triple x86_64-pc-windows-msvc19.0.0 -fopenmp -fms-compatibility -x c++ -emit-llvm %s -o - | FileCheck %s +// expected-no-diagnostics +// REQUIRES: x86-registered-target +extern "C" { +void __cpuid(int[4], int); +} + +// CHECK-LABEL: @main +int main(void) { + __try { + int info[4]; + __cpuid(info, 1); + } __except (1) { + } + + return 0; +} +