X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FAnalysis%2FCFGPrinter.h;h=035764837e6f017a3f22598c935770b5f95501b1;hb=ae65a7a88e8cf63c9ad01e1483181cb7e7bf6f55;hp=759afcaee13277bb2ec8f8590e31ef737e1703db;hpb=255907042245b77779e3e38c5ce66901866cabe5;p=oota-llvm.git diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index 759afcaee13..035764837e6 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -36,7 +36,9 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { if (!Node->getName().empty()) return Node->getName().str(); - string_ostream OS; + std::string Str; + raw_string_ostream OS(Str); + Node->printAsOperand(OS, false); return OS.str(); } @@ -44,7 +46,8 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { static std::string getCompleteNodeLabel(const BasicBlock *Node, const Function *) { enum { MaxColumns = 80 }; - string_ostream OS; + std::string Str; + raw_string_ostream OS(Str); if (Node->getName().empty()) { Node->printAsOperand(OS, false); @@ -69,13 +72,13 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { OutStr.erase(OutStr.begin()+i, OutStr.begin()+Idx); --i; } else if (ColNum == MaxColumns) { // Wrap lines. - if (LastSpace) { - OutStr.insert(LastSpace, "\\l..."); - ColNum = i - LastSpace; - LastSpace = 0; - i += 3; // The loop will advance 'i' again. - } - // Else keep trying to find a space. + // Wrap very long names even though we can't find a space. + if (!LastSpace) + LastSpace = i; + OutStr.insert(LastSpace, "\\l..."); + ColNum = i - LastSpace; + LastSpace = 0; + i += 3; // The loop will advance 'i' again. } else ++ColNum; @@ -106,7 +109,8 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { if (SuccNo == 0) return "def"; - string_ostream OS; + std::string Str; + raw_string_ostream OS(Str); SwitchInst::ConstCaseIt Case = SwitchInst::ConstCaseIt::fromSuccessorIndex(SI, SuccNo); OS << Case.getCaseValue()->getValue();