paulwalker-arm created this revision.
Herald added a subscriber: tschuett.
Herald added a project: All.
paulwalker-arm requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, jplehr, sstefan1.
Herald added a project: clang.

Fixes #62087


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148919

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaOpenMP/arm-sve-acle-types.cpp


Index: clang/test/SemaOpenMP/arm-sve-acle-types.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaOpenMP/arm-sve-acle-types.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fopenmp -fsyntax-only -triple aarch64-arm-none-eabi 
-target-feature +sve -verify %s
+// expected-no-diagnostics
+
+__SVBool_t foo(int);
+
+void test() {
+#pragma omp parallel
+  {
+    __SVBool_t pg = foo(1);
+  }
+}
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -8705,7 +8705,7 @@
   }
 
   // Check that SVE types are only used in functions with SVE available.
-  if (T->isSVESizelessBuiltinType() && CurContext->isFunctionOrMethod()) {
+  if (T->isSVESizelessBuiltinType() && isa<FunctionDecl>(CurContext)) {
     const FunctionDecl *FD = cast<FunctionDecl>(CurContext);
     llvm::StringMap<bool> CallerFeatureMap;
     Context.getFunctionFeatureMap(CallerFeatureMap, FD);


Index: clang/test/SemaOpenMP/arm-sve-acle-types.cpp
===================================================================
--- /dev/null
+++ clang/test/SemaOpenMP/arm-sve-acle-types.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fopenmp -fsyntax-only -triple aarch64-arm-none-eabi -target-feature +sve -verify %s
+// expected-no-diagnostics
+
+__SVBool_t foo(int);
+
+void test() {
+#pragma omp parallel
+  {
+    __SVBool_t pg = foo(1);
+  }
+}
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -8705,7 +8705,7 @@
   }
 
   // Check that SVE types are only used in functions with SVE available.
-  if (T->isSVESizelessBuiltinType() && CurContext->isFunctionOrMethod()) {
+  if (T->isSVESizelessBuiltinType() && isa<FunctionDecl>(CurContext)) {
     const FunctionDecl *FD = cast<FunctionDecl>(CurContext);
     llvm::StringMap<bool> CallerFeatureMap;
     Context.getFunctionFeatureMap(CallerFeatureMap, FD);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to