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