Skip to content

Commit 25e2ff3

Browse files
committed
constify
1 parent 114e4ec commit 25e2ff3

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class Interpreter {
197197
/// @name Value and pretty printing support
198198
/// @{
199199

200-
std::string ValueDataToString(const Value &V);
200+
std::string ValueDataToString(const Value &V) const;
201201
std::string ValueTypeToString(const Value &V) const;
202202

203203
llvm::Expected<Expr *> convertExprToValue(Expr *E);

clang/include/clang/Interpreter/Value.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ class REPL_EXTERNAL_VISIBILITY Value {
119119
~Value();
120120

121121
void printType(llvm::raw_ostream &Out) const;
122-
void printData(llvm::raw_ostream &Out);
123-
void print(llvm::raw_ostream &Out);
124-
void dump();
122+
void printData(llvm::raw_ostream &Out) const;
123+
void print(llvm::raw_ostream &Out) const;
124+
void dump() const;
125125
void clear();
126126

127127
ASTContext &getASTContext();

clang/lib/Interpreter/InterpreterValuePrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,15 @@ static std::string CharPtrToString(const char *Ptr) {
180180
namespace clang {
181181

182182
struct ValueRef : public Value {
183-
ValueRef(Interpreter *In, void *Ty) : Value(In, Ty) {
183+
ValueRef(const Interpreter *In, void *Ty)
184+
: Value(const_cast<Interpreter *>(In), Ty) {
184185
// Tell the base class to not try to deallocate if it manages the value.
185186
IsManuallyAlloc = false;
186187
}
187188
void setData(long double D) { Data.m_LongDouble = D; }
188189
};
189190

190-
std::string Interpreter::ValueDataToString(const Value &V) {
191+
std::string Interpreter::ValueDataToString(const Value &V) const {
191192
Sema &S = getCompilerInstance()->getSema();
192193
ASTContext &Ctx = S.getASTContext();
193194

clang/lib/Interpreter/Value.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,18 @@ const ASTContext &Value::getASTContext() const {
254254
return getInterpreter().getASTContext();
255255
}
256256

257-
void Value::dump() { print(llvm::outs()); }
257+
void Value::dump() const { print(llvm::outs()); }
258258

259259
void Value::printType(llvm::raw_ostream &Out) const {
260260
Out << Interp->ValueTypeToString(*this);
261261
}
262262

263-
void Value::printData(llvm::raw_ostream &Out) {
263+
void Value::printData(llvm::raw_ostream &Out) const {
264264
Out << Interp->ValueDataToString(*this);
265265
}
266266
// FIXME: We do not support the multiple inheritance case where one of the base
267267
// classes has a pretty-printer and the other does not.
268-
void Value::print(llvm::raw_ostream &Out) {
268+
void Value::print(llvm::raw_ostream &Out) const {
269269
assert(OpaqueType != nullptr && "Can't print default Value");
270270

271271
// Don't even try to print a void or an invalid type, it doesn't make sense.

0 commit comments

Comments
 (0)