Skip to content

Commit

Permalink
[CGExprConstant] Avoid use of ConstantExpr::getIntegerCast() (NFC)
Browse files Browse the repository at this point in the history
We're working on a ConstantInt here, so folding cannot fail. Only
avoid the API use.
  • Loading branch information
nikic committed Nov 1, 2023
1 parent 2efea51 commit 5084891
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/lib/CodeGen/CGExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1930,8 +1930,9 @@ ConstantLValueEmitter::tryEmitAbsolute(llvm::Type *destTy) {
// FIXME: signedness depends on the original integer type.
auto intptrTy = CGM.getDataLayout().getIntPtrType(destPtrTy);
llvm::Constant *C;
C = llvm::ConstantExpr::getIntegerCast(getOffset(), intptrTy,
/*isSigned*/ false);
C = llvm::ConstantFoldIntegerCast(getOffset(), intptrTy, /*isSigned*/ false,
CGM.getDataLayout());
assert(C && "Must have folded, as Offset is a ConstantInt");
C = llvm::ConstantExpr::getIntToPtr(C, destPtrTy);
return C;
}
Expand Down

0 comments on commit 5084891

Please sign in to comment.