File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -156,15 +156,28 @@ LLVM_DUMP_METHOD void Program::dump(llvm::raw_ostream &OS) const {
156156 }
157157 Desc->dump (OS);
158158
159- if (Desc->IsTemporary ) {
159+ if (GP. isInitialized () && Desc->IsTemporary ) {
160160 if (const auto *MTE =
161161 dyn_cast_if_present<MaterializeTemporaryExpr>(Desc->asExpr ());
162162 MTE && MTE->getLifetimeExtendedTemporaryDecl ()) {
163- const APValue *V = MTE->getLifetimeExtendedTemporaryDecl ()->getValue ();
164- if (V->isInt ())
165- OS << " (global temporary value: " << V->getInt () << " )" ;
166- else
167- OS << " (huh?)" ;
163+ if (const APValue *V =
164+ MTE->getLifetimeExtendedTemporaryDecl ()->getValue ()) {
165+ OS << " (global temporary value: " ;
166+ {
167+ ColorScope SC (OS, true , {llvm::raw_ostream::BRIGHT_MAGENTA, true });
168+ std::string VStr;
169+ llvm::raw_string_ostream SS (VStr);
170+ V->dump (SS, Ctx.getASTContext ());
171+
172+ for (unsigned I = 0 ; I != VStr.size (); ++I) {
173+ if (VStr[I] == ' \n ' )
174+ VStr[I] = ' ' ;
175+ }
176+ VStr.pop_back (); // Remove the newline (or now space) at the end.
177+ OS << VStr;
178+ }
179+ OS << ' )' ;
180+ }
168181 }
169182 }
170183
You can’t perform that action at this time.
0 commit comments