Skip to content

Commit 5022a5f

Browse files
committed
Mark llvm::ConstantExpr::getAsInstruction as const
Summary: getAsInstruction is the only non-const member method. It is impossible to enforce const-correctness because of it. Reviewers: jmolloy, majnemer Reviewed By: jmolloy Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70113
1 parent 44e5879 commit 5022a5f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/IR/Constants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ class ConstantExpr : public Constant {
12501250
/// which would take a ConstantExpr parameter, but that would have spread
12511251
/// implementation details of ConstantExpr outside of Constants.cpp, which
12521252
/// would make it harder to remove ConstantExprs altogether.
1253-
Instruction *getAsInstruction();
1253+
Instruction *getAsInstruction() const;
12541254

12551255
/// Methods for support type inquiry through isa, cast, and dyn_cast:
12561256
static bool classof(const Value *V) {

llvm/lib/IR/Constants.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3004,7 +3004,7 @@ Value *ConstantExpr::handleOperandChangeImpl(Value *From, Value *ToV) {
30043004
NewOps, this, From, To, NumUpdated, OperandNo);
30053005
}
30063006

3007-
Instruction *ConstantExpr::getAsInstruction() {
3007+
Instruction *ConstantExpr::getAsInstruction() const {
30083008
SmallVector<Value *, 4> ValueOperands(op_begin(), op_end());
30093009
ArrayRef<Value*> Ops(ValueOperands);
30103010

0 commit comments

Comments
 (0)