Skip to content

Commit 8f6cbba

Browse files
committed
update according to the comments
1 parent bd111e6 commit 8f6cbba

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12951,7 +12951,7 @@ def err_builtin_invalid_arg_type: Error<
1295112951
"%plural{0:|: }3"
1295212952
"%plural{[0,3]:type|:types}1 (was %4)">;
1295312953

12954-
def err_bswapg_bitint_not_16bit_aligned : Error<
12954+
def err_bswapg_invalid_bit_width : Error<
1295512955
"_BitInt type %0 (%1 bits) must be a multiple of 16 bits for byte swapping">;
1295612956

1295712957
def err_builtin_trivially_relocate_invalid_arg_type: Error <

clang/lib/Sema/SemaChecking.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,11 +2240,10 @@ static bool BuiltinBswapg(Sema &S, CallExpr *TheCall) {
22402240
<< ArgTy;
22412241
return true;
22422242
}
2243-
const auto *bitIntType = dyn_cast<BitIntType>(ArgTy);
2244-
if (bitIntType != nullptr) {
2245-
if (bitIntType->getNumBits() % 16 != 0 && bitIntType->getNumBits() != 8) {
2246-
S.Diag(Arg->getBeginLoc(), diag::err_bswapg_bitint_not_16bit_aligned)
2247-
<< ArgTy << bitIntType->getNumBits();
2243+
if (const auto *BT = dyn_cast<BitIntType>(ArgTy)) {
2244+
if (BT->getNumBits() % 16 != 0 && BT->getNumBits() != 8) {
2245+
S.Diag(Arg->getBeginLoc(), diag::err_bswapg_invalid_bit_width)
2246+
<< ArgTy << BT->getNumBits();
22482247
return true;
22492248
}
22502249
}

0 commit comments

Comments
 (0)