@@ -55,6 +55,8 @@ 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>>>" ;
59+ extern const char * const kInvalid = " <<<invalid>>>" ;
5860 }
5961}
6062
@@ -602,7 +604,7 @@ static std::string callPrintValue(const Value& V, const void* Val) {
602604 " Could not execute cling::printValue with '%0'" );
603605 Diag.Report (Interp->getSourceLocation (), ID) << getTypeString (V);
604606
605- return " ERROR in cling's callPrintValue(): missing value string. " ;
607+ return valuePrinterInternal:: kUndefined ;
606608}
607609
608610template <typename T>
@@ -847,18 +849,20 @@ namespace cling {
847849 }
848850 strm << " ]" ;
849851 } else
850- strm << " <<<invalid>>> " << printAddress (value, ' @' );
852+ strm << valuePrinterInternal:: kInvalid << ' ' << printAddress (value, ' @' );
851853
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