[clang] [clang-repl] Lay the basic infrastructure for pretty printing of types (PR #148701)
Vassil Vassilev via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 14 22:16:54 PDT 2025
================
@@ -250,17 +254,35 @@ const ASTContext &Value::getASTContext() const {
return getInterpreter().getASTContext();
}
-void Value::dump() const { print(llvm::outs()); }
+void Value::dump() { print(llvm::outs()); }
void Value::printType(llvm::raw_ostream &Out) const {
- Out << "Not implement yet.\n";
+ Out << Interp->ValueTypeToString(*this);
}
-void Value::printData(llvm::raw_ostream &Out) const {
- Out << "Not implement yet.\n";
+
+void Value::printData(llvm::raw_ostream &Out) {
+ Out << Interp->ValueDataToString(*this);
}
-void Value::print(llvm::raw_ostream &Out) const {
+// FIXME: We do not support the multiple inheritance case where one of the base
+// classes has a pretty-printer and the other does not.
+void Value::print(llvm::raw_ostream &Out) {
assert(OpaqueType != nullptr && "Can't print default Value");
- Out << "Not implement yet.\n";
+
+ // Don't even try to print a void or an invalid type, it doesn't make sense.
+ if (getType()->isVoidType() || !isValid())
----------------
vgvassilev wrote:
We could, that would be different compared to what cling does. I am debating with myself if we should implement it -- can we defer this for a later PR?
https://github.com/llvm/llvm-project/pull/148701
More information about the cfe-commits
mailing list