summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-03-18 04:13:55 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-03-18 04:13:55 +0000
commit91797559acb50c46c77aa200253caefc6acdd11c (patch)
tree22dbda14214e64141e3ff1f658a192e053434bd1 /clang/lib
parent4deaac780c9e84aeb46fa9d4ce75870d95f6e436 (diff)
downloadbcm5719-llvm-91797559acb50c46c77aa200253caefc6acdd11c.tar.gz
bcm5719-llvm-91797559acb50c46c77aa200253caefc6acdd11c.zip
[OPENMP] Fix crash on code emitting if errors are found.
Codegen for threadprivate variables (and in some other cases) may cause crash of the compiler if some diagnostic is produced later. This happens because some of the autogenerated globals are not removed from InternalVars StringMap when llvm::Module is reset. Differential Revision: http://reviews.llvm.org/D8360 llvm-svn: 232610
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp4
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.h1
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
3 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 9d33b16fab7..25755838013 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -211,6 +211,10 @@ CGOpenMPRuntime::CGOpenMPRuntime(CodeGenModule &CGM)
KmpCriticalNameTy = llvm::ArrayType::get(CGM.Int32Ty, /*NumElements*/ 8);
}
+void CGOpenMPRuntime::clear() {
+ InternalVars.clear();
+}
+
llvm::Value *
CGOpenMPRuntime::emitOutlinedFunction(const OMPExecutableDirective &D,
const VarDecl *ThreadIDVar) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index e9f389de3ff..a3f957045d7 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -278,6 +278,7 @@ class CGOpenMPRuntime {
public:
explicit CGOpenMPRuntime(CodeGenModule &CGM);
virtual ~CGOpenMPRuntime() {}
+ virtual void clear();
/// \brief Emits outlined function for the specified OpenMP directive \a D.
/// This outlined function has type void(*)(kmp_int32 *ThreadID, kmp_int32
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index c91de6df9e9..b25f315709e 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -323,6 +323,8 @@ void CodeGenModule::checkAliases() {
void CodeGenModule::clear() {
DeferredDeclsToEmit.clear();
+ if (OpenMPRuntime)
+ OpenMPRuntime->clear();
}
void InstrProfStats::reportDiagnostics(DiagnosticsEngine &Diags,
OpenPOWER on IntegriCloud