[PATCH] D91376: [OPENMP]Fix PR47790: segfault in frontend while parsing Objective-C with OpenMP.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 13:27:12 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07b568a9c8db: [OPENMP]Fix PR47790: segfault in frontend while parsing Objective-C with OpenMP. (authored by ABataev).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91376

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaObjCXX/objcxx_openmp.mm


Index: clang/test/SemaObjCXX/objcxx_openmp.mm
===================================================================
--- /dev/null
+++ clang/test/SemaObjCXX/objcxx_openmp.mm
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fopenmp -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+class Foo {
+  int a;
+};
+
+ at interface NSObject
+ at end
+
+ at interface Bar : NSObject {
+  Foo *foo;
+}
+- (void)setSystemAndWindowCocoa:(class Foo *)foo_1;
+
+ at end
+
+ at implementation Bar : NSObject
+- (void)setSystemAndWindowCocoa:(Foo *)foo_1 {
+  foo = foo_1;
+}
+ at end
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -14598,7 +14598,7 @@
     DiscardCleanupsInEvaluationContext();
   }
 
-  if (LangOpts.OpenMP || LangOpts.CUDA || LangOpts.SYCLIsDevice) {
+  if (FD && (LangOpts.OpenMP || LangOpts.CUDA || LangOpts.SYCLIsDevice)) {
     auto ES = getEmissionStatus(FD);
     if (ES == Sema::FunctionEmissionStatus::Emitted ||
         ES == Sema::FunctionEmissionStatus::Unknown)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91376.304956.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201112/f37a6c2a/attachment.bin>


More information about the cfe-commits mailing list