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;
+};
+
+@interface NSObject
+@end
+
+@interface Bar : NSObject {
+  Foo *foo;
+}
+- (void)setSystemAndWindowCocoa:(class Foo *)foo_1;
+
+@end
+
+@implementation Bar : NSObject
+- (void)setSystemAndWindowCocoa:(Foo *)foo_1 {
+  foo = foo_1;
+}
+@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)


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;
+};
+
+@interface NSObject
+@end
+
+@interface Bar : NSObject {
+  Foo *foo;
+}
+- (void)setSystemAndWindowCocoa:(class Foo *)foo_1;
+
+@end
+
+@implementation Bar : NSObject
+- (void)setSystemAndWindowCocoa:(Foo *)foo_1 {
+  foo = foo_1;
+}
+@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)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to