[PATCH] D148919: [Clang][Sema] Fix invalid cast when validating SVE types within CheckVariableDeclarationType.

Paul Walker via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 24 05:46:35 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG2bb7e00b098c: [Clang][Sema] Fix invalid cast when validating SVE types within… (authored by paulwalker-arm).

Repository:
  rG LLVM Github Monorepo

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

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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148919.516371.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230424/87493e34/attachment.bin>


More information about the cfe-commits mailing list