File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed
include/clang/Interpreter Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ class Interpreter {
197
197
// / @name Value and pretty printing support
198
198
// / @{
199
199
200
- std::string ValueDataToString (const Value &V);
200
+ std::string ValueDataToString (const Value &V) const ;
201
201
std::string ValueTypeToString (const Value &V) const ;
202
202
203
203
llvm::Expected<Expr *> convertExprToValue (Expr *E);
Original file line number Diff line number Diff line change @@ -119,9 +119,9 @@ class REPL_EXTERNAL_VISIBILITY Value {
119
119
~Value ();
120
120
121
121
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 ;
125
125
void clear ();
126
126
127
127
ASTContext &getASTContext ();
Original file line number Diff line number Diff line change @@ -180,14 +180,15 @@ static std::string CharPtrToString(const char *Ptr) {
180
180
namespace clang {
181
181
182
182
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) {
184
185
// Tell the base class to not try to deallocate if it manages the value.
185
186
IsManuallyAlloc = false ;
186
187
}
187
188
void setData (long double D) { Data.m_LongDouble = D; }
188
189
};
189
190
190
- std::string Interpreter::ValueDataToString (const Value &V) {
191
+ std::string Interpreter::ValueDataToString (const Value &V) const {
191
192
Sema &S = getCompilerInstance ()->getSema ();
192
193
ASTContext &Ctx = S.getASTContext ();
193
194
Original file line number Diff line number Diff line change @@ -254,18 +254,18 @@ const ASTContext &Value::getASTContext() const {
254
254
return getInterpreter ().getASTContext ();
255
255
}
256
256
257
- void Value::dump () { print (llvm::outs ()); }
257
+ void Value::dump () const { print (llvm::outs ()); }
258
258
259
259
void Value::printType (llvm::raw_ostream &Out) const {
260
260
Out << Interp->ValueTypeToString (*this );
261
261
}
262
262
263
- void Value::printData (llvm::raw_ostream &Out) {
263
+ void Value::printData (llvm::raw_ostream &Out) const {
264
264
Out << Interp->ValueDataToString (*this );
265
265
}
266
266
// FIXME: We do not support the multiple inheritance case where one of the base
267
267
// 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 {
269
269
assert (OpaqueType != nullptr && " Can't print default Value" );
270
270
271
271
// Don't even try to print a void or an invalid type, it doesn't make sense.
You can’t perform that action at this time.
0 commit comments