@@ -55,6 +55,7 @@ extern "C" void cling_PrintValue(void * /*cling::Value**/ V) {
5555namespace cling {
5656 namespace valuePrinterInternal {
5757 extern const char * const kEmptyCollection = " {}" ;
58+ extern const char * const kUndefined = " <undefined>" ;
5859 }
5960}
6061
@@ -602,7 +603,7 @@ static std::string callPrintValue(const Value& V, const void* Val) {
602603 " Could not execute cling::printValue with '%0'" );
603604 Diag.Report (Interp->getSourceLocation (), ID) << getTypeString (V);
604605
605- return " ERROR in cling's callPrintValue(): missing value string. " ;
606+ return valuePrinterInternal:: kUndefined ;
606607}
607608
608609template <typename T>
@@ -846,19 +847,22 @@ namespace cling {
846847 strm << printUnpackedClingValue (*value);
847848 }
848849 strm << " ]" ;
849- } else
850- strm << " <<<invalid>>> " << printAddress (value, ' @' );
851-
850+ } else {
851+ strm << valuePrinterInternal::kUndefined
852+ << ' ' << printAddress (value, ' @' );
853+ }
852854 return strm.str ();
853855 }
854856
855857 namespace valuePrinterInternal {
856858
857859 std::string printTypeInternal (const Value &V) {
860+ assert (V.getInterpreter () && " Invalid cling::Value" );
858861 return printQualType (V.getASTContext (), V.getType ());
859862 }
860863
861864 std::string printValueInternal (const Value &V) {
865+ assert (V.getInterpreter () && " Invalid cling::Value" );
862866 static bool includedRuntimePrintValue = false ; // initialized only once as a static function variable
863867 // Include "RuntimePrintValue.h" only on the first printing.
864868 // This keeps the interpreter lightweight and reduces the startup time.
0 commit comments