Skip to content

Commit 9a07d7e

Browse files
Dinar TemirbulatovDinar Temirbulatov
authored andcommitted
[Sema] Check if types are resolved before querying function description.
1 parent a5757c5 commit 9a07d7e

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,11 +3507,15 @@ bool Sema::ParseSVEImmChecks(
35073507
static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) {
35083508
if (FD->hasAttr<ArmLocallyStreamingAttr>())
35093509
return ArmStreaming;
3510-
if (const auto *T = FD->getType()->getAs<FunctionProtoType>()) {
3511-
if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
3512-
return ArmStreaming;
3513-
if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask)
3514-
return ArmStreamingCompatible;
3510+
if (const Type *Ty = FD->getType().getTypePtrOrNull()) {
3511+
if (const auto *FPT = Ty->getAs<FunctionProtoType>()) {
3512+
if (FPT->getAArch64SMEAttributes() &
3513+
FunctionType::SME_PStateSMEnabledMask)
3514+
return ArmStreaming;
3515+
if (FPT->getAArch64SMEAttributes() &
3516+
FunctionType::SME_PStateSMCompatibleMask)
3517+
return ArmStreamingCompatible;
3518+
}
35153519
}
35163520
return ArmNonStreaming;
35173521
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -fsyntax-only %s
2+
3+
// REQUIRES: aarch64-registered-target || arm-registered-target
4+
5+
// expected-no-diagnostics
6+
7+
struct a {};
8+
__SVFloat32_t b(a);
9+
template <class c> using e = decltype(b(c()));
10+
e<a> f(a);
11+
template <class c> using h = decltype(f(c()));
12+
template <class g> struct i {
13+
static void j() {
14+
a d;
15+
g()(d);
16+
}
17+
};
18+
struct k {
19+
template <class c> void operator()(c) {
20+
[](h<c>) {};
21+
}
22+
void l() { i<k>::j; }
23+
};

0 commit comments

Comments
 (0)