From d7aab0685a4b4241dc7618f0003a9c5430b944de Mon Sep 17 00:00:00 2001
From: Hans Wennborg <hans@hanshq.net>
Date: Tue, 12 Jan 2016 20:54:36 +0000
Subject: [PATCH] Don't store CGOpenMPRegionInfo::CodeGen as a reference
 (PR26078)

The referenced llvm::function_ref<void(CodeGenFunction &)> object can go
away before CodeGen is used, resulting in a crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257516 91177308-0d34-0410-b5e6-96231b3b80d8
---
 lib/CodeGen/CGOpenMPRuntime.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
index 6d4fc9f64b4..3b97ba2469a 100644
--- a/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -84,7 +84,7 @@ public:
 
 protected:
   CGOpenMPRegionKind RegionKind;
-  const RegionCodeGenTy &CodeGen;
+  RegionCodeGenTy CodeGen;
   OpenMPDirectiveKind Kind;
   bool HasCancel;
 };
-- 
GitLab