[AST][RecoveryExpr] Fix an assertion crash on openMP.

Summary:
With recovery expr, it is possible that we have a value-dependent expr
within non-dependent context.

Reviewers: sammccall, jdoerfert

Subscribers: yaxunl, guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80200
This commit is contained in:
Haojian Wu 2020-05-19 12:02:52 +02:00
parent e86f3075f8
commit 23954318f4
2 changed files with 7 additions and 2 deletions

View File

@ -6896,8 +6896,8 @@ bool OpenMPIterationSpaceChecker::checkAndSetInc(Expr *S) {
static ExprResult
tryBuildCapture(Sema &SemaRef, Expr *Capture,
llvm::MapVector<const Expr *, DeclRefExpr *> &Captures) {
if (SemaRef.CurContext->isDependentContext())
return ExprResult(Capture);
if (SemaRef.CurContext->isDependentContext() || Capture->containsErrors())
return Capture;
if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects))
return SemaRef.PerformImplicitConversion(
Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting,

View File

@ -0,0 +1,5 @@
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -frecovery-ast %s
void foo(int i) {
#pragma omp target update from(i) device(undef()) // expected-error {{use of undeclared identifier 'undef'}}
}