forked from OSchip/llvm-project
[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
This commit is contained in:
parent
4deaac780c
commit
91797559ac
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -323,6 +323,8 @@ void CodeGenModule::checkAliases() {
|
|||
|
||||
void CodeGenModule::clear() {
|
||||
DeferredDeclsToEmit.clear();
|
||||
if (OpenMPRuntime)
|
||||
OpenMPRuntime->clear();
|
||||
}
|
||||
|
||||
void InstrProfStats::reportDiagnostics(DiagnosticsEngine &Diags,
|
||||
|
|
|
@ -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 '('}}
|
||||
|
|
Loading…
Reference in New Issue