[clang] [clang-repl] Lay the basic infrastructure for pretty printing of types (PR #148701)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 14 12:14:55 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())
----------------
AaronBallman wrote:
Shouldn't a `void` type at least print the type?
https://github.com/llvm/llvm-project/pull/148701
More information about the cfe-commits
mailing list