[PATCH] [OPENMP] Fix crash on code emitting if errors are found.
Alexey Bataev
a.bataev at hotmail.com
Tue Mar 17 21:16:34 PDT 2015
REPOSITORY
rL LLVM
http://reviews.llvm.org/D8360
Files:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/OpenMP/threadprivate_messages.cpp
Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
===================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h
@@ -278,6 +278,7 @@
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
Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp
@@ -323,6 +323,8 @@
void CodeGenModule::clear() {
DeferredDeclsToEmit.clear();
+ if (OpenMPRuntime)
+ OpenMPRuntime->clear();
}
void InstrProfStats::reportDiagnostics(DiagnosticsEngine &Diags,
Index: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -211,6 +211,10 @@
KmpCriticalNameTy = llvm::ArrayType::get(CGM.Int32Ty, /*NumElements*/ 8);
}
+void CGOpenMPRuntime::clear() {
+ InternalVars.clear();
+}
+
llvm::Value *
CGOpenMPRuntime::emitOutlinedFunction(const OMPExecutableDirective &D,
const VarDecl *ThreadIDVar) {
Index: cfe/trunk/test/OpenMP/threadprivate_messages.cpp
===================================================================
--- cfe/trunk/test/OpenMP/threadprivate_messages.cpp
+++ cfe/trunk/test/OpenMP/threadprivate_messages.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
+// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp=libiomp5 -ferror-limit 100 -emit-llvm -o - %s
#pragma omp threadprivate // expected-error {{expected '(' after 'threadprivate'}}
#pragma omp threadprivate( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8360.22155.patch
Type: text/x-patch
Size: 2125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150318/5a04f2f4/attachment.bin>
More information about the cfe-commits
mailing list