Skip to content

Commit 0dae7b4

Browse files
eopXDfanghuaqi
authored andcommitted
[Clang][RISCV] Use Decl for checkRVVTypeSupport (llvm#65778)
Using ValueDecl will cause error for OpenMP. Decl should do the work.
1 parent 18e79ef commit 0dae7b4

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
@@ -13632,7 +13632,7 @@ class Sema final {
1363213632
bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
1363313633
bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
1363413634
CallExpr *TheCall);
13635-
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D);
13635+
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D);
1363613636
bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
1363713637
unsigned BuiltinID, CallExpr *TheCall);
1363813638
bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5416,7 +5416,7 @@ bool Sema::CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
54165416
return false;
54175417
}
54185418

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

clang/lib/Sema/SemaDecl.cpp

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

87878787
if (T->isRVVType())
8788-
checkRVVTypeSupport(T, NewVD->getLocation(), cast<ValueDecl>(CurContext));
8788+
checkRVVTypeSupport(T, NewVD->getLocation(), cast<Decl>(CurContext));
87898789
}
87908790

87918791
/// 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)