llvm.org GIT mirror llvm / 7921239
Add back functionality removed in r210497. Instead of asserting, output a message stating that a null pointer was found. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211430 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Trieu 6 years ago
7 changed file(s) with 34 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
602602 bool runOnSCC(CallGraphSCC &SCC) override {
603603 Out << Banner;
604604 for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
605 assert((*I)->getFunction() && "Expecting non-null Function");
606 (*I)->getFunction()->print(Out);
605 if ((*I)->getFunction())
606 (*I)->getFunction()->print(Out);
607 else
608 Out << "Printing Function";
607609 }
608610 return false;
609611 }
286286 OS << ")";
287287 }
288288 OS << " in ";
289 assert(UI->getUser() != nullptr && "Expected non-null User");
290 UI->getUser()->print(OS);
289 if (UI->getUser())
290 UI->getUser()->print(OS);
291 else
292 OS << "Printing User";
291293 OS << '\n';
292294 }
293295 }
4444 for (Loop::block_iterator b = L->block_begin(), be = L->block_end();
4545 b != be;
4646 ++b) {
47 assert((*b) != nullptr && "Expecting non-null block");
48 (*b)->print(Out);
47 if (*b)
48 (*b)->print(Out);
49 else
50 Out << "Printing block";
4951 }
5052 return false;
5153 }
195195 bool runOnRegion(Region *R, RGPassManager &RGM) override {
196196 Out << Banner;
197197 for (const auto &BB : R->blocks()) {
198 assert(BB != nullptr && "Expecting non-null Block");
199 BB->print(Out);
198 if (BB)
199 BB->print(Out);
200 else
201 Out << "Printing Block";
200202 }
201203
202204 return false;
18651865 SmallString<8> StrVal;
18661866 CFP->getValueAPF().toString(StrVal);
18671867
1868 assert(CFP->getType() != nullptr && "Expecting non-null Type");
1869 CFP->getType()->print(AP.OutStreamer.GetCommentOS());
1868 if (CFP->getType())
1869 CFP->getType()->print(AP.OutStreamer.GetCommentOS());
1870 else
1871 AP.OutStreamer.GetCommentOS() << "Printing Type";
18701872 AP.OutStreamer.GetCommentOS() << ' ' << StrVal << '\n';
18711873 }
18721874
280280 std::string buf;
281281 raw_string_ostream os(buf);
282282
283 assert(unwrap(Ty) != nullptr && "Expecting non-null Type");
284 unwrap(Ty)->print(os);
283 if (unwrap(Ty))
284 unwrap(Ty)->print(os);
285 else
286 os << "Printing Type";
287
285288 os.flush();
286289
287290 return strdup(buf.c_str());
531534 std::string buf;
532535 raw_string_ostream os(buf);
533536
534 assert(unwrap(Val) != nullptr && "Expecting non-null Value");
535 unwrap(Val)->print(os);
537 if (unwrap(Val))
538 unwrap(Val)->print(os);
539 else
540 os << "Printing Value";
541
536542 os.flush();
537543
538544 return strdup(buf.c_str());
351351 }
352352
353353 std::string getTypeName(Type *T) {
354 assert(T != nullptr && "Expecting non-null Type");
355354 std::string TypeName;
356355 raw_string_ostream TypeStream(TypeName);
357 T->print(TypeStream);
356 if (T)
357 T->print(TypeStream);
358 else
359 TypeStream << "Printing Type";
358360 TypeStream.flush();
359361 return TypeName;
360362 }