[clang] 9a07d7e - [Sema] Check if types are resolved before querying function description.
Dinar Temirbulatov via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 19 07:02:43 PDT 2024
Author: Dinar Temirbulatov
Date: 2024-04-19T14:02:02Z
New Revision: 9a07d7ea9b37a5b537fc8099cc5744f44da29abc
URL: https://github.com/llvm/llvm-project/commit/9a07d7ea9b37a5b537fc8099cc5744f44da29abc
DIFF: https://github.com/llvm/llvm-project/commit/9a07d7ea9b37a5b537fc8099cc5744f44da29abc.diff
LOG: [Sema] Check if types are resolved before querying function description.
Added:
clang/test/SemaCXX/aarch64-sve-resolve-type.cpp
Modified:
clang/lib/Sema/SemaChecking.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6778bc6607f75e..73e76e05a0d9d1 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3507,11 +3507,15 @@ bool Sema::ParseSVEImmChecks(
static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) {
if (FD->hasAttr<ArmLocallyStreamingAttr>())
return ArmStreaming;
- if (const auto *T = FD->getType()->getAs<FunctionProtoType>()) {
- if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
- return ArmStreaming;
- if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask)
- return ArmStreamingCompatible;
+ if (const Type *Ty = FD->getType().getTypePtrOrNull()) {
+ if (const auto *FPT = Ty->getAs<FunctionProtoType>()) {
+ if (FPT->getAArch64SMEAttributes() &
+ FunctionType::SME_PStateSMEnabledMask)
+ return ArmStreaming;
+ if (FPT->getAArch64SMEAttributes() &
+ FunctionType::SME_PStateSMCompatibleMask)
+ return ArmStreamingCompatible;
+ }
}
return ArmNonStreaming;
}
diff --git a/clang/test/SemaCXX/aarch64-sve-resolve-type.cpp b/clang/test/SemaCXX/aarch64-sve-resolve-type.cpp
new file mode 100644
index 00000000000000..7a563848cdcf98
--- /dev/null
+++ b/clang/test/SemaCXX/aarch64-sve-resolve-type.cpp
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only %s
+
+// REQUIRES: aarch64-registered-target || arm-registered-target
+
+// expected-no-diagnostics
+
+struct a {};
+__SVFloat32_t b(a);
+template <class c> using e = decltype(b(c()));
+e<a> f(a);
+template <class c> using h = decltype(f(c()));
+template <class g> struct i {
+ static void j() {
+ a d;
+ g()(d);
+ }
+};
+struct k {
+ template <class c> void operator()(c) {
+ [](h<c>) {};
+ }
+ void l() { i<k>::j; }
+};
More information about the cfe-commits
mailing list