Skip to content

Commit 78c12d3

Browse files
[Sema] Remove unnecessary casts (NFC) (#148338)
NumElts, a member variable of ArrayTypeInfo, is already of Expr *.
1 parent 6d98f67 commit 78c12d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
20212021
return ExprError(Diag(Chunk.Loc, diag::err_array_new_needs_size)
20222022
<< D.getSourceRange());
20232023

2024-
ArraySize = static_cast<Expr*>(Chunk.Arr.NumElts);
2024+
ArraySize = Chunk.Arr.NumElts;
20252025
D.DropFirstTypeObject();
20262026
}
20272027

@@ -2032,7 +2032,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
20322032
break;
20332033

20342034
DeclaratorChunk::ArrayTypeInfo &Array = D.getTypeObject(I).Arr;
2035-
if (Expr *NumElts = (Expr *)Array.NumElts) {
2035+
if (Expr *NumElts = Array.NumElts) {
20362036
if (!NumElts->isTypeDependent() && !NumElts->isValueDependent()) {
20372037
// FIXME: GCC permits constant folding here. We should either do so consistently
20382038
// or not do so at all, rather than changing behavior in C++14 onwards.

clang/lib/Sema/SemaType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4727,7 +4727,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
47274727
// Build the type anyway.
47284728
}
47294729
DeclaratorChunk::ArrayTypeInfo &ATI = DeclType.Arr;
4730-
Expr *ArraySize = static_cast<Expr*>(ATI.NumElts);
4730+
Expr *ArraySize = ATI.NumElts;
47314731
ArraySizeModifier ASM;
47324732

47334733
// Microsoft property fields can have multiple sizeless array chunks

0 commit comments

Comments
 (0)