[PATCH] D80200: [AST][RecoveryExpr] Fix an assertion crash on openMP.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 06:29:02 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG23954318f49f: [AST][RecoveryExpr] Fix an assertion crash on openMP. (authored by hokein).
Herald added a subscriber: sstefan1.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80200/new/

https://reviews.llvm.org/D80200

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/recovery-crash.cpp


Index: clang/test/OpenMP/recovery-crash.cpp
===================================================================
--- /dev/null
+++ clang/test/OpenMP/recovery-crash.cpp
@@ -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'}}
+}
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -6896,8 +6896,8 @@
 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80200.264881.patch
Type: text/x-patch
Size: 1108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200519/247978d5/attachment.bin>


More information about the cfe-commits mailing list