[clang] [compiler-rt] [clang-repl] Reimplement value printing using MemoryAccess to support in-process and out-of-process (PR #156649)

Vassil Vassilev via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 23:41:59 PDT 2025


================
@@ -267,92 +267,156 @@ std::string Interpreter::ValueDataToString(const Value &V) const {
       return "{ error: unknown builtin type '" + std::to_string(BT->getKind()) +
              " '}";
     case clang::BuiltinType::Bool:
-      SS << ((V.getBool()) ? "true" : "false");
-      return Str;
-    case clang::BuiltinType::Char_S:
-      SS << '\'' << V.getChar_S() << '\'';
-      return Str;
-    case clang::BuiltinType::SChar:
-      SS << '\'' << V.getSChar() << '\'';
-      return Str;
-    case clang::BuiltinType::Char_U:
-      SS << '\'' << V.getChar_U() << '\'';
-      return Str;
-    case clang::BuiltinType::UChar:
-      SS << '\'' << V.getUChar() << '\'';
+      SS << ((B.as<bool>()) ? "true" : "false");
       return Str;
     case clang::BuiltinType::Short:
-      SS << V.getShort();
+      SS << B.as<short>();
----------------
vgvassilev wrote:

Why we have to cast the data when we know its type? If that's needed for out-of-process where the host and target architectures do not match, we should probably somehow do it in a separate facility because `getX` is much faster on matching architectures.

https://github.com/llvm/llvm-project/pull/156649


More information about the llvm-commits mailing list