Skip to content

Commit 77b7b1a

Browse files
authored
[Clang][RISCV] Use Decl for checkRVVTypeSupport (llvm#65778)
Using ValueDecl will cause error for OpenMP. Decl should do the work.
1 parent 8fdf61a commit 77b7b1a

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13754,7 +13754,7 @@ class Sema final {
1375413754
bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
1375513755
bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
1375613756
CallExpr *TheCall);
13757-
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D);
13757+
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D);
1375813758
bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
1375913759
unsigned BuiltinID, CallExpr *TheCall);
1376013760
bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5514,7 +5514,7 @@ bool Sema::CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
55145514
return false;
55155515
}
55165516

5517-
void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D) {
5517+
void Sema::checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D) {
55185518
const TargetInfo &TI = Context.getTargetInfo();
55195519
// (ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1) requires at
55205520
// least zve64x

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8866,7 +8866,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
88668866
}
88678867

88688868
if (T->isRVVType())
8869-
checkRVVTypeSupport(T, NewVD->getLocation(), cast<ValueDecl>(CurContext));
8869+
checkRVVTypeSupport(T, NewVD->getLocation(), cast<Decl>(CurContext));
88708870
}
88718871

88728872
/// Perform semantic checking on a newly-created variable
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clang_cc1 -triple riscv64 -target-feature +v -fsyntax-only \
2+
// RUN: -verify -fopenmp %s
3+
// REQUIRES: riscv-registered-target
4+
5+
// expected-no-diagnostics
6+
7+
void foo() {
8+
#pragma omp parallel
9+
{
10+
__rvv_int32m1_t i32m1;
11+
}
12+
}

0 commit comments

Comments
 (0)